[Gc] libgc not collecting objects with cyclic references ?

Christophe Meessen meessen at cppm.in2p3.fr
Mon Mar 19 05:31:59 PST 2007


> Bruce Hoult wrote:
>
> If A has a pointer to B then it's presumably using B in some way, so
> you can't finalize B first because then things in A may crash.  But if
> B has a pointer to A then presumably it's using A in some way, so you
> can't finalize A first because then things in B might crash.  It's
> insoluable.  The GC hasn't got enough information to know what is
> safe. 

I thought that one of the purpose of a finalizer is to solve to issue
you describe. Suppose A is an element in a doubly linked list to be
collected, the finalizer of A has simply to detach it from the list to
resolve the issue.

Is the destructor registered as a finalizer function and is the
destructor called on collected objects derived from the gc class ?




More information about the Gc mailing list