From: David Leal Date: 2001-06-26T23:41:54+09:00 Subject: [ruby-talk:16900] Re: finalizers, destructors and whatnot In article , "ts" wrote: > D> define_finalizer( obj, proc { |id| _id2ref( id ).close } > > t> You don't need it, ruby will try to close the object when it's > garbage t> collected. > > I've forgotten to say if it's an IO object What I actually want is that a connection to a database (I'm using pgsql) be closed automatically when an object goes out of scope. I think it's somewhat weird having the finalize methods being defined with ObjectSpace. Shouldn't there be a finalize method in the Object class? David