[gclist] Allowing finalizers to wait for the messiah.

Hans Boehm boehm@hoh.mti.sgi.com
Thu, 22 May 1997 08:54:08 -0700


On May 22,  4:28pm, Mark Tillotson wrote:
> Charles Fiterman <cef@geodesic.com> replied:
> > You've missed the ugliest question. What if a finalizer stores
> > a pointer to its object. You now have a pointer to free space.
> The normal way to do things is to
> 1  trace from everything but the finalizer list
> 2  identify the moribund objects by traversing the list
>    looking for untraced objects, which you remove from the list
>    place on a second "finalize now" list.
> 3  trace from everything on the "finalize now" list
> 4  reclaim dead objects
> 5  pop the objects off the "finalize now" list and call the finalize
>    method
>

Or if you want topological ordering (e.g. Cedar & almost Modula 3, but not
Java):
1  trace from everything but the finalizer list
2  trace all objects reachable from the finalizer list by following one or more
pointers.
3. Put every untraced object from the finalizer list onto the "finalize now"
list, marking or copying it in the process.
4  reclaim dead objects
5  pop the objects off the "finalize now" list and call the finalize
   method

Hans

-- 
Hans-Juergen Boehm
boehm@mti.sgi.com