[Ruby] Ghetto
Ryan Davis
ryand-ruby at zenspider.com
Thu Jan 3 12:03:50 PST 2008
On Jan 3, 2008, at 11:36 , javier ramirez wrote:
> Yes, he explained it and it's true for the original code. I was just
> trying to clarify how with a little change in the code, by using a
> variable as the container of the object, the GC will keep the right
> count of references so the object will be freed when it executes if no
> longer needed.
Just to be a little anal, it isn't reference counting. It is rooting
all objects on the C stack. When the GC starts, it follows all known
roots to find all known objects. Since you're still in the same C
stack, it is still rooted.
More information about the Ruby
mailing list