On Fri, Oct 21, 2005 at 08:45:38PM +0900, Florian Weber wrote: > When I simply remove the class using remove_const it will still be > available via the ObjectSpace though, so that doesn't really work :/ > > > Basically I want this test to pass: > > class Foo > end > > # removing the class somehow > > ObjectSpace.each_object(Class) do |klass| > assert !(Foo > klass) > end I think this is the same or a similar issue the Rails guys were dealing with at the conference with their memory leak. One solution I know of is to remove the constant and then set it to an empty class: Object.class_eval do remove_const :Foo const_set :Foo, Class.new { } end GC.start I think this is because Ruby is storing the class in rb_class_tbl when it is defined, and there is no way to remove an entry from the table, only replace it. This may be a bug or an oversight; I don't know. Paul