Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

libtbb new/delete

Penunuri__David
Beginner
223 Views

I am trying to parallelize an application that uses new/delete from the standard libraries to allocate/deallocate memory.  In my code I replaced a traditional for loop with the parallel_for template.  When the execution reaches the parallel_for and a few threads are running my application crashes.  The error messages suggest a problem with memory allocation/deallocation.  I have used libtbb.so and libtbbmalloc.so. but it still crashes.  I tried to use libtbbmalloc_proxy.so but the program will not link.  Says it cannot find libtbbmalloc_proxy.so.2 even though it is in the same folder as the other libraries.

The problem seems to be a conflict in memory allocation.  I am adding my code to a commercial application so I cannot rebuild the whole application.  Any suggestions on how solve?

0 Kudos
3 Replies
Alexei_K_Intel
Employee
223 Views

Usually, there is no limitations with new/delete inside parallel_loop. The observed issue might relate to some data races or double free problems. Could you describe how you replaced the serial loop with parallel_for, please? Did you use lambda interface?

Nikita_P_Intel
Employee
223 Views

Hi David,

You can use LD_PRELOAD=$LIB_PATH/libtbbmalloc_proxy.so.2 to make sure, that your application uses tbbmalloc routines. If the crash still happens, could you please send an error log.

Nikita

Akbarzadeh__Afshin
223 Views

I have the same problem in my codes.

I have bunch of functions running with TBB parallel for loop. In each one of I use some local STL containers. When I run the app, it the beginning it is OK but after a while the application crashes. The thrown exception says it might be double deleting of STL container.
The problem is random but it is all about deleting one of STL containers.
I am sure that I've set up the code to use tbb scalable allocator but the problem still holds

Reply