
31 Jan
2006
31 Jan
'06
2:48 p.m.
David Maisonave wrote:
"Peter Dimov" <pdimov@mmltd.net> 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