Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Yuan_Y_1
Beginner
186 Views

question about memory leak by using pipeline

when I initial like this: tbb::task_scheduler_init parallel, the program has memory leak, but when I set it as: task_scheduler_init init(1), there is no memory leak. 

I want to know the reason.

ps: the visual leak detector(VLD) can't detect the memory leak. but I run the program in a loop, and the same time monitor the memory usage delta, indeed the memory leak.

0 Kudos
2 Replies
Alexei_K_Intel
Employee
186 Views

Hi,

It is not clear from your description what causes the leak. What TBB algorithms and data structures do you use? What is the TBB version? Do you observe the constant delta or is it increasing over the time? Does the delta depend on the number of iterations in the loop? What is the approximate algorithm structure? Could you provide a reproducer? Could you provide some information that you think can help us to troubleshot the issue, please?

Thank you in advance.

Regards, Alex

Yuan_Y_1
Beginner
186 Views

Thanks for reply.

The TBB version is 41 and the algorithms is pipeline class, we use Visual Studio 2010. Today, I find the example of pipeline which providing by TBB also have memory leak. Maybe the reason is that when we use the pipeline with parallel mode, we use task_scheduler_init class to create some threads, and threads are not destroyed.  

I will use the square.cpp(TBB provided in /example/pipeline)as example to show the memory leak.

            { // serial run
                if ( !silent ) printf("serial run   ");
                tbb::task_scheduler_init init_serial(1);
                if(!run_pipeline (1))
                    return 1;
            }
            { // parallel run (number of threads is selected automatically)
                if ( !silent ) printf("parallel run ");
                tbb::task_scheduler_init init_parallel;
                if(!run_pipeline (init_parallel.default_num_threads()))
                    return 1;
            }

if the "parallel run" was executed,  the leak will be happened, it's ok for "serial run".  The output memory leaks as shown in the figure.

memory leak.png

Maybe I use the pipeline class in a wrong way. In my program, I initial the TBB every time in one loop, so I see the memory increasing  slowly over the time.

Reply