Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost:interprocess 1.36.0 - Minimum size for a shared memory segment
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-02-03 13:30:05


Federico Golfrè Andreasi wrote:
> Hi !
>
> which is the minimum number of bytes I have to allocate to
> construct a managed shared memory? Or how can I calculate it?
> I did some tests and I believe is 112 bytes for 32 bit machines and 224
> bytes for 64 bit, am I right ?

I haven't measured it. It's highly dependant on the memory algorithm,
the index type and compiler ABI.

> And for the allocators?
>
> What I want to do is set the size of the shared memory smaller than I
> can, knowing the dimension of the variables
> I want to put in; even if the code is compiled in 64 bit or 32 bit machines.

I'm afraid the size won't be guaranteed, because that would be too
limiting for Interprocess development. Anyway, even if you create a
shared memory with 1 byte, you will be wasting
"mapped_region::get_page_size()" bytes, because the OS can map pages
smaller than that. In 32 unix systems that's 4K, in Win32 64K. So use
that value.

> Thank you,
> Federico

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