Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Shared Memory Compilation Issue
From: TONGARI (tongari95_at_[hidden])
Date: 2011-07-27 15:03:20

2011/7/28 Nathan Lewis <nathanlewissubscription_at_[hidden]>

> TONGARI <tongari95 <at>> writes:
> >
> >
> > Generally, you should not deallocate what you didn't allocate by
> yourself.It's
> the container's job to deallocate its elems, and it's your job to destruct
> the
> container when you don't need it anymore, like:
> segment.destroy<ComplexDataVector>("ComplexDataVector");
> >
> Lots of good learning points I appreciate the learning opportunity. So is
> what
> you are explaining is that one would just pop the elements out of the
> vector and
> then they would be deleted when this call is made by the resource that
> "owns" it
> and is done with it:
> segment.destroy<ComplexDataVector>("ComplexDataVector");
> Or are you explaining that when the pop is called, the internals of the
> vector
> implementation invokes the destruction of the object.

Yes. And the allocation/deallocation is performed by the container, say,
ComplexDataVector, when it needs to adjust its internal storage.

segment.destroy<...>(...) will destruct the found object and deallocate the
It's analog of "delete".

I so appreciate your responses, it has been tremendously helpful. Working
> with
> Boost Interprocess has made me think a lot more about the
> allocation/deallocation process that tends to get abstracted away but is
> useful
> in understanding.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at