Impossible to enforce garbage collection

R

Robert Pankowecki

But 'puts 12345' is executed at the end of the program instead in the
middle of the test.
 
R

Robert Klemme

http://pastie.org/1970654

Can anyone tell me why the object created with finializer is not garbage
collected during GC.start executed in line 10 please ?

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
 
R

Roger Pack

Robert Pankowecki wrote in post #1000863:
http://pastie.org/1970654

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-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top