I am writing a simple wrapper around boost::interprocess's vector container to implement a ring buffer in shared memory (shm) for IPC. Assume that buf
is an instance of RingBuffer
created in shm. Now, in its ctor, buf
itself allocates a private boost::interprocess::vector
data member to store values, e.g. m_data
. My question is: I think m_data
should also be created in shared memory. But it this a necessity?
What happens if buf
that was created in shm itself, allocates standard memory, i.e. using new
. Does this get allocated on the calling process's heap? I don't think buf
is allocated there so how come a data member that is private to an object not on a process's heap gets allocated there. I'm confused.