Marc Magrans de Abril wrote:
Dear colleagues,
I have been testing the boost interprocess library for two months in my spare time... everything looked ok until now. Perhaps I am doing something wrong, so be patient.
As you can see in the code, I am trying to use the offset_ptr within a class named OffsetPtrClass. However, if I try to allocate the int inside the OffsetPtrClass cnstructor I'll get a segmentation fault in the getter (either the MASTER or the SLAVE forked processes). I a running on Linux kernel 2.6.16 and g++ 3.4.xx.
What I am doing wrong?
I don't quite understand what your code is doing but first you should have created the shared memory before trying to open it. This code does not guarantee it. Another option is to create the shared memory first and fork after it. If you try to allocate the int in the master while constructing OffsetPtrClass in shared memory using a different ip::managed_shared_memory, are you sure that does not throw?
Thanks for your help, marc
I need a bit more data to help you, Ion