Community
cancel
Showing results for 
Search instead for 
Did you mean: 
wzpstbb
Beginner
127 Views

TBB Warning: Leaked 1 observer_proxy objects.

Jump to solution

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!

0 Kudos
1 Solution
Kirill_R_Intel
Employee
127 Views

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. 

View solution in original post

2 Replies
Kirill_R_Intel
Employee
128 Views

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. 

View solution in original post

wzpstbb
Beginner
127 Views

Thanks Kirill for the valuable clue. I have fixed this warning. 

Reply