2011/5/19 Marsh Ray
On 05/19/2011 10:52 AM, Gaetan Gaumer wrote:
So I have two questions : 1) Do you have an idea why the mmap function maps the segment at a different address from the provided one, knowing that this address is the one returned from code below on another process (so should be valid) ?
Perhaps that address space was already being used by something. This is likely to be the case with large regions on a 32-bit OS.
It's indeed used by something as it is the address of the segment return by a new fixed_managed_shared_memory(boost::interprocess::create_only,...)
How large is is the segment you're trying to map?
Currently 250MB but we want to use bigger segments soon.
Is your process running as 64- or 32-bits?
64 bits
2) In the mapped_region constructor, when a non null address value is given as a parameter, could we use the MAP_FIXED flag to force the mmap function to map the segment at the provided address ?
What happens if something else is already at that address?
According to mmap spec (http://pubs.opengroup.org/onlinepubs/009695399/functions/mmap.html) "mmap() may return MAP_FAILED and set errno to [EINVAL]" But in our case the address is used by the segment we want to open...