Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Preallocation

ali_n_
Beginner
366 Views

Hi,

I remember reading somewhere that if you link TBBMalloc or potentially use Scalabale Allocator, TBB will pre-allocates some amount of memory per thread to avoid implicit synchronizations. But i can't find this any more. I thought I found this in TBB Book but looks like it wasn't. 

Is there any per thread preallocation happens in Scalable Allocator or in TBBMalloc?

Many Thanks.

0 Kudos
3 Replies
Alexei_K_Intel
Employee
366 Views

Hi Ali,

In many cases Scalable Allocator and TBBMalloc are the same thing. It is different names/interfaces for Intel TBB scalable allocator (libtbbmalloc.so, tbbmalloc.dll or libtbbmalloc.dylib). The internal logic is highly complex but, in naive way, we can say that per thread and global caches are used to avoid/reduce implicit synchronizations and make some preallocation.

If you have some specific questions, feel free to ask.

Regards,
Alex
 

0 Kudos
ali_n_
Beginner
366 Views

Hi Alex,

Thanks a lot for clarifying that. Any suggestion about where I can find details about preallocations you mentioned? Specifically amount of memory it claims per thread. At the moment I have an application that using this library and in some cases it's using excessive heap. I also observed amount of memory varying depending on thread/core count on my computer. 

Thanks,

Ali

0 Kudos
jimdempseyatthecove
Honored Contributor III
366 Views

>>At the moment I have an application that using this library and in some cases it's using excessive heap

This may happen when the thread that allocates the memory is not the same thread that frees the same memory.

Jim Dempsey

0 Kudos
Reply