[plt-scheme] Memory management and ?custodians

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Wed Mar 3 17:08:01 EST 2010

Matthew, hello.

On 2010 Mar 3, at 21:03, Matthew Flatt wrote:

> Are you using finalizers to release the wrapped values? If so, the
> finalizer for the one to be released first could refer to the one that
> should be released last.

Many thanks for this -- it sounds like this matches my problem quite closely.

You mention register-finalizer, which is described in the FFI docs.  Up to now I've been looking solely at the 'Inside' documentation (perhaps I should have mentioned that).  I take it from what you say that the two aren't as mutually exclusive as I'd guessed.  Are there any major non-obvious gotchas?

> Switching to 3m could solve that problem. With CGC, it's easy for a
> dead reference to be sitting somewhere that the GC thinks is live.

That's interesting.  3m looks a bit scary, but clearly also The Right Thing.

All the best,


Norman Gray  :  http://nxg.me.uk

Posted on the users mailing list.