Subject: ability to run finalizers at a given point of a program?
From: Guillaume Cottenceau <gcottenc gmail.com>
Date: Wed, 13 Apr 2005 01:44:05 +0900

Hi,
I'm considering the possibility to run the finalizers at a given point
of a program. I have written the following program, and I'm
experiencing the following unexpected behaviour: I call GC.start in
the hope that finalizers of unscoped objects that have one will be
run, but it seems they aren't.
http://www.zarb.org/~gc/t/prog/destructor/nodestructor.rb
I have written the following program in ocaml, which has a closer GC
implementation than perl or python (these have reference counting,
ocaml doesn't) and it seems that contrary to Ruby, finalizers are run
as expected when a GC run is forced (however, when the closure used as
finalizer has a reference to anything inside the object, this counts
as a reference thus object is always scoped, so this is not really
useful as a finalizer/destructor anyway).
http://www.zarb.org/~gc/t/prog/destructor/destructor.ml
Do you guys have any insight with ruby behaviour? I use 1.8.2 on Linux.
--
Guillaume Cottenceau - http://zarb.org/~gc/