Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost::shared_ptr] Memory is not freed
From: Igor R (boost.lists_at_[hidden])
Date: 2011-03-27 19:11:41


> I wish I could include the code in this email, but it is very long  and
> complicated. Therefore, I am kindly asking you to guess what might have been
> wrong with the boost:shared_ptr. Could you think of any scenarios that would
> cause the observed bahavior?

Circular references.
If A has shared_ptr to B, and B has shared_ptr to A, they both will
never be release.
To break such circular referencing, you should use weak_ptr for one direction.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net