Boost logo

Boost :

Subject: Re: [boost] Need urgent help >> How to Handle Fragmentation in Boost's managed_shared_memory
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2017-08-17 22:06:56

On 17/08/2017 19:05, Andrey Semashev via Boost wrote:
> On 08/17/17 19:22, vijay sharma via Boost wrote:
>> I am using Boost::managed_shared_memory for my project. For allocate and
>> deallocate we are using boost APIs as show in below example:
>> shm_controller.reset(new boost::interprocess::managed_shared_memory(
>> boost::interprocess::open_or_create, shmName, size));void * addr =
>> shm_controller->allocate(size) ;
>> shm_controller ->deallocate(addr);
>> For this I have two question:
>> 1) How can i handle fragmentation in this ? We are doing very frequent
>> allocation and release.

If those allocation are due to node-based containers, then a pool
allocator might help. Otherwise, you need to transfer all objects to a
new segment so that all memory is allocated nearly contiguously.


Boost list run by bdawes at, gregod at, cpdaniel at, john at