typedef tbb::memory_pool<tbb::scalable_allocator<char>> MemoryPool;
I have one use case where I need to store objects for a long time. However, for this use case I also need to do a lot of malloc and free calls. After I free an object, does the memory_pool implementation fill previously freed blocks when calling malloc? If yes, are there any limitations?
The short answer is that the memory_pool implementation reuses previously freed blocks when calling malloc if possible. However, the algorithm logic is too complex to be described in one answer. It would be great if you provide a bit more details about your memory access pattern: What are the typical allocation sizes? Do you have multithreaded allocations? Do you allocate and deallocate memory on the same thread?