0

I am able to create shared memory segment containing struct using apr_shm_create problem is when I try to create class instance in this shared struct (segmentation fault). Is there any way to allocate custom object (and underlying data) in shared memory ? What I am trying to do is to create shared queue with strings between all apache processes.

Thanks in advance

Kryštof Hilar
  • 609
  • 2
  • 10
  • 22

1 Answers1

0

You can use placement new operator (see http://en.cppreference.com/w/cpp/language/new) but don't forget memory will not be mapped at the same address in any process, so you can't have pointers in objects in shared memory

Bastien Durel
  • 603
  • 5
  • 20