Hi,
In message "[ruby-talk:6889] Ruby "finalize", "__del__""
on 00/12/07, Clemens Wyss <wys / helbling.ch> writes:
|is there a "finalize" method for Ruby classes which is called just before
|being sweeped out by GC. (counterpart to "initialize", i.e. a destructor).
|I don't want to use the ObjectSpace.define_finalizer() for all instances of
|my class (i.e. by overloading the new-method).
No. It is not provided intentionally.
"finalizer" methods are very troublesome for GC. Since it often
"resurrects" the dying objects. How about calling define_finalizer in
initialize method? See tempfile.rb for example.
matz.