A
Andreas Schwarz
Hello,
I'm really confused by the behaviour of the following code:
irb(main):038:0> Thread.start do
irb(main):039:1* Mysql.connect('localhost', 'test', '', 'test')
irb(main):040:1> end
=> #<Thread:0x401de1f4 dead>
irb(main):041:0> ObjectSpace.each_object(Mysql) do |o| puts o.id end
537850026
=> 1
irb(main):042:0> GC.start
=> nil
irb(main):043:0> ObjectSpace.each_object(Mysql) do |o| puts o.id end
537850026
=> 1
Why does the Mysql object still exist after GC.start?
Andreas
I'm really confused by the behaviour of the following code:
irb(main):038:0> Thread.start do
irb(main):039:1* Mysql.connect('localhost', 'test', '', 'test')
irb(main):040:1> end
=> #<Thread:0x401de1f4 dead>
irb(main):041:0> ObjectSpace.each_object(Mysql) do |o| puts o.id end
537850026
=> 1
irb(main):042:0> GC.start
=> nil
irb(main):043:0> ObjectSpace.each_object(Mysql) do |o| puts o.id end
537850026
=> 1
Why does the Mysql object still exist after GC.start?
Andreas