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

From: Hans Oesterholt-Dijkema (hdnews at gawab.com)
Date: Tue Aug 23 04:33:49 EDT 2005

>If you have a dozen such X, though, and none of them get collected,
>then I agree that something must be wrong.
>  
>
I've got a dozen such X. What does help is using scheme_malloc_atomic().
I'm working on a new collection scheme between mzgtk2 and Gtk+2. In this
scheme gobjects would be automatically reclaimed and gtk reference counting
would be used to make sure nothing gets reclaimed too early. Well, it's 
more
difficult than that.

I've also an other problem.

I'm using a finalizer. What doesn't work is, putting a finalizer on a 
scheme_malloced
memory location. What works, is putting the finalizer on an object 
returned by
scheme_make_cptr(). What I actually wanted to do was:

  (guard_t  *) G=(guard_t *) scheme_malloc[_atomic](sizeof(guard_t));
  scheme_register_finalizer(G,fin_func,G,NULL,NULL);

This doesn't work (for both situations). What works is this:

  (guard_t  *) G=(guard_t *) scheme_malloc[_atomic](sizeof(guard_t));
   Scheme_Object *obj=scheme_make_cptr(G,GObjectType);
  scheme_register_finalizer(obj,fin_func,G,NULL,NULL);
 
Is this normal behaviour?

Best whishes,
Hans


  

>One way to try to debug this is to configure a build with
>--enable-sgcdebug. Then it's possible to use `dump-memory-stats' to
>show why the GC thinks that X is still. (Run `(dump-memory-stats)' and
>read the end of the output for more info.)
>
>Matthew
>
>  
>



Posted on the users mailing list.