Can anyone tell me why the object created with finializer is not garbage
collected during GC.start executed in line 10 please ?
Robert Pankowecki
···
--
Posted via http://www.ruby-forum.com/.
Can anyone tell me why the object created with finializer is not garbage
collected during GC.start executed in line 10 please ?
Robert Pankowecki
--
Posted via http://www.ruby-forum.com/.
Because exceptions thrown in finalizers are silently ignored:
http://rxr.whitequark.org/mri/source/gc.c#2862
(note the last rb_protect).
On Wed, 25 May 2011 20:11:20 +0900, Robert Pankowecki wrote:
Can anyone tell me why the object created with finializer is not garbage
collected during GC.start executed in line 10 please ?Robert Pankowecki
--
WBR, Peter Zotov.
But 'puts 12345' is executed at the end of the program instead in the
middle of the test.
--
Posted via http://www.ruby-forum.com/.
There are no guarantees - neither about when GC will occur nor about
which objects it will collect. AFAIK Ruby MRI's GC doesn't even
bother to do something until your memory usage goes beyond a
particular point. It's unlikely that you reach that point with your
test.
Kind regards
robert
On Wed, May 25, 2011 at 1:11 PM, Robert Pankowecki <robert.pankowecki@gmail.com> wrote:
Can anyone tell me why the object created with finializer is not garbage
collected during GC.start executed in line 10 please ?
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Robert Pankowecki wrote in post #1000863:
Can anyone tell me why the object created with finializer is not garbage
collected during GC.start executed in line 10 please ?
The GC puts "objects with finalizers" on a queue to be GC'ed later,
because (I guess) it doesn't want to run any ruby code during the middle
of the GC run.
-roger-
--
Posted via http://www.ruby-forum.com/\.