[Ironruby-core] Something's wrong with ObjectSpace

Tomas Matousek Tomas.Matousek at microsoft.com
Sun Oct 25 19:00:36 EDT 2009

This is by design. We don't support enumerating objects that are not modules. A string instance is not a module.
Why do you need to enumerate all allocated strings? 


-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman
Sent: Sunday, October 25, 2009 1:26 PM
To: ironruby-core
Subject: [Ironruby-core] Something's wrong with ObjectSpace


The next REPL session works fine in MRI but in IR it throws an error:
>>> str = "sss"
=> "sss"
>>> ObjectSpace.each_object(String) { |x| puts x }
`each_object': each_object only supported for objects of type Class or Module (RuntimeError)
        from :0

I looked a bit into it and IR identifies String as a descendant of Object and not Module as it expects. This problem makes it impossible to run each_object on Numeric as well (and I guess more types that are mapped directly to CLR types).

Should I create a bug?

Shay Friedman
Author of IronRuby Unleashed
Follow me: http://twitter.com/ironshay
Ironruby-core mailing list
Ironruby-core at rubyforge.org

More information about the Ironruby-core mailing list