I have a flow graph where the objects are too heavy to pass by copy, so instead I'm passing a shared pointer to the object through the graph. What I noticed is that my deleters for some of those objects were being deferred until graph destruction because the graph nodes were holding copies, which is too late for my needs. I had expected them to hold references for only as long as those objects were active in the graph.
I traced this to the item_buffer inside the nodes. The buffer is an expandable queue that stores elements as pairs of (item,valid), and the valid flag is toggled when an item is "alive" or not. When an item is popped from the buffer, the flag is toggled, but the item is left wholly intact. I patched the invalidate() routine of _flow_graph_item_buffer_impl.h (line 55) to add item(i).first=T() ... ie to default-construct a T object after the pop. This solves my problem for the moment, but it's not ideal because not all objects can be default constructed. I'd rather just destruct, as is the case when you pop from most queues.
Can anyone shed any light on why this behavior is as it is?