Boost logo

Boost Users :

Subject: [Boost-users] Interprocess : vectors of vectors
From: Oodini (svdbg____at_[hidden])
Date: 2013-05-13 11:05:44


Hello,

I'd like to share a vector of vectors (jagged 2D array).
The data come from a deserialization.
I know the size of the "external" vector. The sizes of the "internal" vectors are discovered during deserialization.

I read :
http://www.boost.org/doc/libs/1_52_0/doc/html/interprocess/quick_guide.html#interprocess.quick_guide.qg_interprocess_container

and regarding this line :

managed_shared_memory segment(create_only,
                               "MySharedMemory", //segment name
                               65536);

how to set the size (3rd argument), when considering my use case ?

Even with a simple vector, and if the number and the types of the elements are know? i woldn't know what size to set for truncation.
On VS 2010, a sizeof(vector<int>) is 40; I suppose I have to add it sizeof(int)*nbElements to get the full size.

1. I don't know if this assumption is valid
2. If so, I don't know if it's still valid when using Boost.Interprocess (I suppose it isn't)
3. I don't know how to generalize that to a vector of vectors in order what should be the truncation size.

Thanks for help.

PS : I also read
http://www.boost.org/doc/libs/1_52_0/doc/html/interprocess/managed_memory_segments.html,
but I havn't been enlightened about these points.


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