[gclist] Destructor FAQ

Charles Fiterman cef@geode.geodesic.com
Mon, 18 Mar 1996 07:26:22 -0600


An ugly and common problem with finalizers occurs
when A references B and A`s finalizer saves the
reference to B in a static area restoring B to life.

This is not only possible its useful. This means
You can only collect one object in a chain per cycle.

How do we avoid this?

In the four color algorithm when A stored a pointer
to B it would Grey B. Greying an object during the
finalization part of collection would push the cycle 
back to the point where grey objects were being 
examined thus if B refered to C, C would be greyed 
and so on.

Thus the special situation could be recognised restarting
a collection cycle but not rerunning it.