[plt-scheme] cyclic structure doesn't get collected

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Aug 23 09:34:13 EDT 2005

At Tue, 23 Aug 2005 10:33:49 +0200, Hans Oesterholt-Dijkema wrote:
>   (guard_t  *) G=(guard_t *) scheme_malloc[_atomic](sizeof(guard_t));
>   scheme_register_finalizer(G,fin_func,G,NULL,NULL);

If you supply G as data to be kept with the finalizer (third argument),
then G is always reachable, so G can never be finalized.

Pass NULL as the third argument, instead. The first argument is
automatically supplied back to fin_func as its first argument.


Posted on the users mailing list.