[Gc] Re: How to use finalization

Juan Jose Garcia Ripoll lisp at arrakis.es
Mon Jun 12 07:50:33 PDT 2006

On Mon, 2006-06-12 at 16:09 +0200, Ludovic Courtès wrote:
> 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.

Yes, this is what I thought, but then I got this email from one of the

> In my first trial, I used GC_register_finalizer_no_order and made
> a test on a string object, with:
> (let ((x "hello")) (si:finalize x #'myfun) (print x))
> Then I found out that when the string object got finalized, the char
> array associated with it was already GC, leaving just garbage in it.
> Then I looked in the gc.h for some doc and found out that using
> GC_register_finalizer could avoid that problem ("if a points to b ...").

So he ended up using GC_register_finalizer() which is what I used in
other parts of the library that are not exposed to the lisp environment.

I will have a look later at the thread you point to. Gmane seems to be
off-line right now.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://napali.hpl.hp.com/pipermail/gc/attachments/20060612/e620487e/attachment.pgp

More information about the Gc mailing list