From: Brian Candler Date: 2011-08-01T16:48:35+09:00 Subject: Re: system stack error in ObjectSpace.each_object This looks to me like an abuse of ObjectSpace. If you need to keep track of all the objects of class Foo, then it would be better to make some sort of container which keeps track of them explicitly. ObjectSpace is (a) inefficient, because it scans *every* object in the system, and (b) unreliable, because it may show you objects which should have died, but some reference is being held somewhere. ObjectSpace is really just a debugging tool. Also, finalizers are also extremely difficult to work with. There is almost never a good case for using them. You should consider them part of the internals of ruby (so that, for example, when an IO object gets garbage-collected then the underlying file descriptor gets closed) Regards, Brian. -- Posted via http://www.ruby-forum.com/.