
On Sun, May 1, 2011 at 6:16 PM, Phil Bouchard <philippe@fornux.com> 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/rationa...
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