Hi Andy, > Nice sleuthing!
Thanks :) > > If you want to manually handle finalization at 'safe' points from > Scheme, guardians are the things to use. Add your "finalizable" object > to a guardian, and periodically "pump" the guardian to see if anything > is finalizable; you can run the finalizer there. So, the idea would be to create a global guardian with : --8<---------------cut here---------------start------------->8--- (define pointer-guardian (make-guardian)) --8<---------------cut here---------------end--------------->8--- and replace those kind of functions : --8<---------------cut here---------------start------------->8--- (define (pointer->commit! pointer) (set-pointer-finalizer! pointer %commit-free) (pointer->commit pointer)) --8<---------------cut here---------------end--------------->8--- by, --8<---------------cut here---------------start------------->8--- (define (pointer->commit! pointer) (pointer-guardian pointer) (pointer->commit pointer)) --8<---------------cut here---------------end--------------->8--- But then, at shutdown, when I'll call (pointer-guardian) to get the list of free-able pointers, how can I know that %commit-free has to be called on commit pointers, %reference-free on reference pointers, ... ? Thanks, Mathieu