[Gc] Re: How to use finalization

Ludovic Courtès ludovic.courtes at laas.fr
Mon Jun 12 07:09:48 PDT 2006


Hi,

Juan Jose Garcia Ripoll <lisp at arrakis.es> writes:

> We want to support user-level finalization of objects (**), but we
> simply do not know what the garbage collector expects from us. Is there
> a simple example available, or some documentation to this respect?
> Perhaps knowing what the GCJ compiler does would be enough.

I recently implemented "guardians" for a version of Guile (a Scheme
interpreter) based on `libgc'.  Guardians are basically a facility that
allows for user-level finalization.  You might want to read this thread
for details:

  http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/1257

Basically, you need to call `GC_REGISTER_FINALIZER_NO_ORDER ()' and then
you are allowed to do a lot of things from within the finalizer: create
new objects, new references to the object being destroyed, etc.

Thanks,
Ludovic.



More information about the Gc mailing list