- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 allocatedfor tasksare notreleaseddue to some reason.
A membermy_task_node_countshould be equal to zero if everithing was fine. If it is not zero a
'runtime_warning( ... )' method will becalled andthe warning messageis 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
#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:
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page