[gclist] Making finalizers sure, ordered and general.

Charles Fiterman cef@geode.geodesic.com
Mon, 07 Oct 1996 11:28:48 +0100


Where a class defines a finalizer the finalizer linkage needs
to be in the object. Finalizer linkage is a forward and backward
pointer connecting it to a finalizer queue.

When objects with finalizer's are constructed they are simply
added to a LIFO queue. Thus finalizers will tend to run LIFO
which is the most logical order. A finalizer object may need
to describe ordering saying run my finalizer before the finalizer
of some other object. Thus a buffer finalizer that uses a file
object can say be sure my finalizer is run before the file object's
finalizer should they both come up the same cycle. This simply
moves the finalizer on the queue.

If an object contains multiple finalizer objects they can live
in different places in the finalizer queue.


Charles Fiterman	Geodesic Systems
Phone 312-728-7196	4745 N. Ravenswood Suite 111
Fax   312-728-6096	Chicago Il 60015

A language without garbage collection is
like a city without garbage collection.