- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Recently I added my custom task scheduler observer. I got the following warning when debugging:
TBB Warning: Leaked 1 observer_proxy objects.
Does anyone know how to get rid of this warning?
My custom observer is pretty simple:
class PipelineObserver : public tbb::task_scheduler_observer
{
ADrawContext& mDC;
void operator=(const PipelineObserver&);
PipelineObserver();
public:
PipelineObserver(ADrawContext& dc)
: mDC(dc)
{
observe(true);
}
~PipelineObserver()
{
observe(false);
}
virtual void on_scheduler_entry(bool /* is_worker */ )
{
if(mDC.HasVirtualDevice())
mDC.VirtualDevice().AcquireLocalOGLContext();
}
};
I used the observer as below:
{
// Pipeline scheduler observer. It observes the worker threads entering the
// task arena.
PipelineObserver o(dc);
// use TBB to execute a parallel while
tbb::parallel_while<ApplyIterator> w;
ApplyIterator body(*this, iteratorStream, eyePosition, maxCell, &w);
w.run(iteratorStream, body);
}
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
First, the warning is not critical. Most likely the observer_proxy object is just destroyed later.
The warning may appear if TBB task scheduler is destroyed earlier than the observer object. It could happen if you explicitly created task_scheduler_observer in the same scope, though I don't see it in your code. If it is really important to avoid the warning, please attach the full code to reproduce the issue.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
First, the warning is not critical. Most likely the observer_proxy object is just destroyed later.
The warning may appear if TBB task scheduler is destroyed earlier than the observer object. It could happen if you explicitly created task_scheduler_observer in the same scope, though I don't see it in your code. If it is really important to avoid the warning, please attach the full code to reproduce the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Kirill for the valuable clue. I have fixed this warning.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page