- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Regards, Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As Alex said, we need more information in order for us to give you a hand with this.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page