
On 24/11/2010 15:21, Aditya Gadre wrote:
Ion,
Thank you for your reply. According to Boost.Interprocess documentation, you *can* share std::vector by using managed shared memory and Boost.Interprocess allocator (please see "Creating vectors in shared memory" in "Quick guide for the impatient" in Boost.Interprocess documentation). Following those guidelines and the example therein , I have successfully shared std::vector object using following -
Believe me, you can't. The example uses boost::interprocess::vector (see using namespace boost::interprocess; and not using namespace std;) http://www.boost.org/doc/libs/1_45_0/doc/html/interprocess/quick_guide.html#... you can't share a std::vector because its internal pointers are normally raw pointers. If two processes map the segment in a different base address it will crash. If you are lucky and both processes map the segment in the same address, then it won't crash, but you have no guarantee for that. For more explanations see: http://www.boost.org/doc/libs/1_45_0/doc/html/interprocess/allocators_contai... Best, Ion