[Newbies] Weakly holding and circular references
btc at openinworld.com
Sun Apr 29 21:51:16 UTC 2018
On 29 April 2018 at 21:35, Tm Jhnsn <digit at sonic.net> wrote:
> Hi all,
> I've tried to learn how to properly use Weak collections for purposes of
> circular references, but I'm not sure I fully understand -- not enough to
> actually use it in my implementation.
> I made a fairly large project a couple of years ago where I ended up with
> a lot of stale information in the image because I had circular references
> keeping objects from being cleared by GC. I learned my lesson, and
> addressed the situation by building a 'release' mechanism and explicitly
> tearing down objects when I was done with them.
Note that since the VM uses a tracing garbage collector rather than
reference counting, circular references *only* between objects 'a' and 'b'
will not in themselves prevent them both being garbage collected. They
will only stick around if one of them has a chain of references through
from a root object.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners