[gclist] Precise GC's performance

David Petrie Stoutamire davids@ICSI.Berkeley.EDU
Fri, 8 Mar 1996 10:29:07 -0800 (PST)


> When the YAFL GC is started, a first mark pass is performed. Then, on all
> objects which have been found not to be reachable anymore from the root sets,
> the KILL method is applied if defined. No deallocation is performed yet. Hence,
> no cycle problem.
> 
> Then, a brand new mark pass is performed, and all objects which have been
> found unreachable on both of these passes are deallocated. This allows for
> "last chance rescue": when a given object is being killed, it can rescue 
> itself from deallocation by setting an external reference to itself as part
> of its KILL method.

It isn't necessary to do another entire mark pass, instead:

    Stop mutator
    Do mark pass
    For each object needing finalization,
       If marked, add to list of objects to finalize at end of GC
       Mark it and all objects it reaches (stopping at objects already marked)
    Sweep
    Finalize everything on the list (could re-enter GC)
    Start mutator

This way only the portion of the heap reachable only from objects about
to be finalized needs to be marked.  There are obvious extensions for
concurrency, deferred sweeping, etc.

    - Dave

--
David Stoutamire
http://www.icsi.berkeley.edu/~davids