On Sunday 24 October 2004 20:23, Michael Neumann wrote:
> On Mon, Oct 25, 2004 at 03:15:21AM +0900, Michael Neumann wrote:
> > How can I force that the GC frees all unreferenced objects? Basically
> > what I want is:
[snip]


I don't know if this helps you?


bash-2.05b$ ruby d.rb
before call
before GC
"string"
recycled
after GC
after call
bash-2.05b$ expand -t2 d.rb
def test
  x = 'string'
  ObjectSpace.define_finalizer(x, proc { puts "recycled" })
  p x
  x = nil
end
f = lambda {
  puts "before GC"
  xoid = test
  GC.start
  puts "after GC"
}
puts "before call"
f.call
GC.start
puts "after call"
bash-2.05b$


--
Simon Strandgaard