Boost logo

Boost :

Subject: Re: [boost] [Block Pointer] Review Request
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-05-01 21:39:07


On Sun, May 1, 2011 at 6:16 PM, Phil Bouchard <philippe_at_[hidden]> wrote:
> On 5/1/2011 6:01 PM, Emil Dotchevski wrote:
>>
>> The way to deal with this situation using shared_ptr is to use
>> weak_ptr to break the cycles. I suppose block_ptr solves this problem
>> more elegantly, but how?
>
> The way it is being handled is explained here:
> https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/doc/rationale.html#cyclicism
>
> If blocks of memory are found to still exist after a standard reference
> counter destruction and that the pointer is living on the stack or data
> segment then each memory blocks will be destructed and deallocated in the
> order they were constructed (FIFO).  Everything is being handled implicitly.

My point is that regardless of the order of destruction, if you have a
cycle, necessarily you will end up with some dangling pointers (smart
or otherwise). How does block_ptr protect against bugs arising from
that?

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk