[plt-scheme] Re: scheme_weak_reference and MZ_PRECISE_GC

From: David Hansen (david.hansen at gmx.net)
Date: Tue Sep 9 10:40:53 EDT 2008

On Tue, 9 Sep 2008 05:23:59 -0600 Matthew Flatt wrote:

> At Tue, 09 Sep 2008 10:57:01 +0200, David Hansen wrote:
>> what's the alternative to scheme_weak_reference() if MZ_PRECISE_GC is
>> defined?  Shall I use a finalizer and the fixup callback?  And how would
>> I use the fixup callback?
> You can use scheme_make_weak_box() with both 3m and CGC.

Hmm, but that gives me another Scheme_Object*.  Now I need something to
weak ref that ;-)

OK, I could scheme_dont_gc_ptr() the weak box and scheme_gc_ptr_ok() the
box in a finalizer of the value the box holds.  But this sounds a bit

I want to keep track of Scheme_Object*s of a custom tagged type.  Can I
do that from the fixup callback I pass to GC_register_traversers()?

If so, how?  The documentation is a bit dense there.  In case the object
moved, how do I get the old and new Scheme_Object*?


Posted on the users mailing list.