Re: [Boost-bugs] [Boost C++ Libraries] #4522: allocation problem after grow

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4522: allocation problem after grow
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-08-08 08:02:14

#4522: allocation problem after grow
  Reporter: razzik@… | Owner: igaztanaga
      Type: Bugs | Status: closed
 Milestone: Boost 1.44.0 | Component: interprocess
   Version: Boost 1.43.0 | Severity: Showstopper
Resolution: invalid | Keywords: interprocess shared_memory ipc grow allocation
Changes (by igaztanaga):

  * status: new => closed
  * resolution: => invalid


 From the help:

 "Boost.Interprocess offers off-line segment growing. What does this mean?
 That the segment can be grown if no process has mapped the managed
 segment. If the application can find a moment where no process is attached
 it can grow or shrink to fit the managed segment."

 So you must unmap, grow and remap it again:

 /* Create SM - Size 100K*/<br>
 managed_shared_memory shm(create_only, "MySM", 100*1024);
 //Unmapped here

 /* Grow SM By 28K*/

 //Remap it
 managed_shared_memory shm(open_only, "MySM");

 /* SM full size - 128K*/
 int fullSMSize = shm.get_size();
 /* SM mem size - 128K - sizeof(SM Header)*/
 int memSMSize = shm.get_free_memory();
 /* alloc 64K in SM (64K<128K)*/
 void* ptr = shm.allocate(64*1024);

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC