Suggestions how to work with FIFO buffer at node's input

Suggestions how to work with FIFO buffer at node's input

A question on tbb:flow. What is the right strategy to use internal FIFO buffer at the input of the function_node?
Imagine a pipeline source_node -> function_node -> function_node -> ..... By default function_node has an infinite buffer in front of it. I am affraid that source_node may overproduce data and the data will consume to much RAM, before everything is processed. What is the right way to control this issue?
I've tried to set all function_node-s as "rejecting". This caused loosing some of the messages. Is it an intentional behavior if node rejects messages or I should seek a bug in my code?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You should probably use a limiter_node as described here:

The Flow Graph "Rejecting" strategy seems to be inherently flawed. When using TBB Flow Graph, from what I can see, you should always use queueing nodes with unlimited concurrency, otherwise you can get weird behaviour.

Thank you for your answer!
I think I got the idea. The TBB manual says that function_node.try_get() always returns false. "A function_node does not contain buffering of its output. Therefore it always rejects try_get calls." That's why nobody should reject messages after function_node.

Leave a Comment

Please sign in to add a comment. Not a member? Join today