Ion GaztaƱaga wrote:
Still, the multi-segment approach can be useful for a single-process approach when using memory mapped files. A process can create a giant growable and persistent memory database creating more files and mapping them. But multi-processing makes growing segments really hard. If someone has any idea or wants to help on this...
In a multi-segment implementation, would an object like a vector be able to span multiple segments? I think not, but I'm not sure. If general growing of managed segments is too hard, maybe an easier problem could be solved, like making shared memory containers that have special support for growing. But I guess you still will need locking, because any time a container is grown, it potentially invalidates everything shared in every process.
When Shmem was reviewed reviewers wanted to avoid the two phase construction and use exceptions. With O_CREAT there is no portable way (if I'm wrong, please correct me) to know if the file/segment was
I agree with you about O_CREAT. But what about on Windows, with CreateFileMapping? "If the object exists before the function call, the function returns a handle to the existing object (with its current size, not the specified size), and GetLastError returns ERROR_ALREADY_EXISTS." It seems the API has a little bit of a POSIX bias. :)