Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2006-01-31 09:48:48


David Maisonave wrote:
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
>> There is no single canonical use for weak_ptr. It's a versatile tool
>> that
>> can be used in every situation that matches the above description. Some
>> people use for it to break shared_ptr cycles.
>
> I just ran a test on this, and it seems that boost::shared_ptr does result
> in leaving memory leak in cycle logic.
> However, when I tested my proposed smart_ptr, it does not have this problem.
> It's able to correctly destroy the objects even in cycles.

Then I guess you should start looking for bugs in your code..

It isn't a "problem" with boost::shared_ptr; it's a property of
reference counting and linking. But really, you should know this.

-- 
Daniel Wallin

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