Warning: Leaked X task objects - some technical details
>>...This warning seems undocumented. Could you explain its meaning?
There is a __TBB_COUNT_TASK_NODES macro. When the __TBB_COUNT_TASK_NODES macro is defined a verification will be done to detect "Task Leaks".
In another words, it warns that some resources allocated for tasks are not released due to some reason. A member my_task_node_count should be equal to zero if everithing was fine. If it is not zero a 'runtime_warning( ... )' method will be called and the warning message is displayed.
Here is some summary from the TBB's sources:
market.h ... #if __TBB_COUNT_TASK_NODES //! Net number of nodes that have been allocated from heap. /** Updated each time a scheduler or arena is destroyed. */ atomic<intptr_t> my_task_node_count; #endif /* __TBB_COUNT_TASK_NODES */ ... #if __TBB_COUNT_TASK_NODES ... //! Net number of nodes that have been allocated from heap. /** Updated each time a scheduler or arena is destroyed. */ void update_task_node_count( intptr_t delta ) { my_task_node_count += delta; } #endif /* __TBB_COUNT_TASK_NODES */ ... market.cpp ... void market::destroy() { #if __TBB_COUNT_TASK_NODES if ( my_task_node_count ) runtime_warning( "Leaked %ld task objects\n", ( long )my_task_node_count ); #endif /* __TBB_COUNT_TASK_NODES */ this->~market(); NFS_Free( this ); __TBB_InitOnce::remove_ref(); } ... scheduler.cpp ... void generic_scheduler::free_scheduler() { ... #if __TBB_COUNT_TASK_NODES my_market->update_task_node_count( my_task_node_count ); #endif /* __TBB_COUNT_TASK_NODES */ ... } ... arena.cpp ... void arena::free_arena() { ... #if __TBB_COUNT_TASK_NODES my_market->update_task_node_count( -drained ); #endif /* __TBB_COUNT_TASK_NODES */ ... } ... There is also a Test-Case at: <TBB>\Src\Test\test_task_leaks.cpp
|