
But I've never heard of a C++ container library that predictively does the same for memory consumption: "Given such-and-such content how many bytes of memory *would* you require?" I can see that for certain use cases, that could be very handy, especially in embedded or realtime systems.
I am studybing this point. If you construct an empty vector in a managed shared memory, you have already 152 bytes consumed. I'd like to be sure that this value is always same.
I suspect, though, that the eventual solution to this particular problem will be a higher-level interface to shared memory that can grow or shrink the resource as needed. For right now, I can only suggest that you overallocate and hope for the best. I will be delighted to hear better suggestions from others!
It seem you can already do that : http://www.boost.org/doc/libs/1_52_0/doc/html/interprocess/managed_memory_se... But as I already know the number of bytes I have to deserialize, I'd like to avoid reallocation.