[plt-scheme] Re: Finalizer or custodian for extension's resources?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jul 14 16:27:31 EDT 2003

At Mon, 14 Jul 2003 22:00:45 +0200, Dirk Gerrits wrote:
> > Use scheme_add_finalizer, instead?
> 
> Doesn't change any of the results.

It looks like changing to scheme_add_finalizer shouldn't have had any
effect (which is good, since the docs don't suggest that there would be
any change in this case).

But I can't reproduce your test results. With strong=0, I get a ~Foo()
when either a couple of GCs happen or the custodian is shut down (e.g.,
when the "Execute" button is pushed in DrScheme for a new REPL). If the
custodian is shut down, I get a redundant ~Foo() on a later GC from the
finalizer.

I wonder whether the problem is just the number of GCs. (Normally, one
is not enough, and partly that's due to conservative GC.) I have to run
(collect-garbage) a couple of times to get ~Foo() without shutting down
the custodian.

Matthew



Posted on the users mailing list.