[racket] FFI/3m and Boehm GC compatibility

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jul 16 13:31:22 EDT 2012

At Mon, 16 Jul 2012 17:33:23 +0100, Tim Brown wrote:
> In any case, I will need to invisibleise the pointer when it is no
> longer in use by racket (i.e. "legitimately" collectable). What would be
> the best way/hook to detect the pointers' end-of-life?

Probably `register-finalizer'.

Beware that when you supply a pointer value to `register-finalizer',
you're really registering a finalizer on the wrapper object and not the
pointer itself; that's usually what you want, but not always. For
example, if you register a finalizer on `p', use `cast' to convert `p'
to `q', and then retain only `q', the finalizer can be triggered for

Posted on the users mailing list.