Hi.
I guess that a hashtable with weak entries and wills might get your job done. http://www.iro.umontreal.ca/~gambit/doc/gambit-c.html#Wills
When your object is not strongly reachable anymore, you do your freeing stuff, and then you let the GC do the rest.
P!
2009/6/28 lowly coder lowlycoder@huoyanjinjing.com:
Is it possible to have an object X so that some function gets called when X is gc-ed?
Suppose I have something like
(define-type foo ...) (define bar (foo-create ...))
and inside of bar, there's a C-land resource that I want to have freed up when bar is GC-ed;
Is there a way to have some function like (foo-gc) s.t. when bar is GC-ed, (foo-gc bar) is called?
Thanks!
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list