[gclist] finalization

David Chase chase@world.std.com
Mon, 19 May 1997 09:04:30 -0400


At 11:36 PM 5/18/97 -0400, I wrote:

>If I had time, I'd tell you in detail, but I don't.  Basic
>idea, if you have optional finalization, is to keep a table
>full of "hidden" pointers (either "encrypted", or simply explicitly
>not scanned by the GC).  After the GC runs, the table must be
>checked for each about-to-be freed cell, and those found in the
>table, are placed in a queue (accessible to the garbage collector,
>now) and the elements in the queue are processed by running
>their finalizers.

For a copying collector, one way to implement this is simply to postpone
copying pointers out of the finalizer table until the very last, keeping
track of where the next evacuation would land, then copying out of the
finalizer queue.  Anything in the finalizer table that points "above"
that saved evacuation point needs to have its finalizer run, and can be
tagged as such, and the finalizer can be run at leisure.  Note that this
copies over bits of otherwise-garbage referenced from finalizable objects.
John Ellis and I discussed this scheme about nine years ago; I might have
the e-mail on tape, if I could find a tape drive to read it.

David