Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-05-30 10:10:38


Jason Sachs wrote:
> From what I understand about Boost shared memory segments, they are not
> infinitely growable, so I think I have to organize my data into chunks
> of a more reasonable size, and allocate a series of separate shared
> memory segments with a few chunks in each. (there are other
> application-specific reasons for me to do this anyway) So I am trying to
> figure out what is a reasonable size is of shared memory to allocate.
> (probably in the 64K - 1MB range but I'm not sure)
>
> Does anyone have any information about the overhead of a shared memory
> segment? Just an order of magnitude estimate, e.g. M bytes fixed + N
> bytes per object allocated + total size of names. Are M,N on the order
> of 10 bytes or 10Kbytes or what?

If you mean the overhead added by a named allocation and indexes, use
managed_shared_memory.get_free_memory() function to know how many bytes
you have after creating the managed segment and after creating an empty
vector.

Take in care that if you fill those vectors alternatively, the
reallocations needed by the vector might not take advantage of all the
needed memory (one vector can end just in the middle of the segment and
the other vector just can't take the memory before and after that
vector). If you need to minimize needed shared memory, pre-calculate all
the data and then dump it in shared memory.

Regards,

Ion


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net