[Ironruby-core] ObjectSpace module

Iulian Fecioru iulian.fecioru at napa.fi
Wed Aug 10 01:50:45 EDT 2011



I've wrote on http://ironruby.codeplex.com/workitem/6028 that the
ObjectSpace module is not complete

Comments from the issues above: "

wrote Thu at 11:57 PM

File.realpath is a Ruby 1.9 method we haven't gotten to.

We're unable to implement those methods of ObjectSpace as we can't track
them ourselves as we don't know when the CLR will garbage collect a
specific object, and we don't have access to a list of reachable

Renaming this issue to track File.realpath


iulianfecioru wrote Fri at 8:27 AM

>From the previous comment I understand that methods from ObjectSpace
(_id2ref, count_objects.) will not be supported.

Is this true?!


PS: I've added _id2ref method to the ObjectSpace, so I think it is
posible but is just my opinion ;)


jimmysch wrote Fri at 4:50 PM

How did you implement _id2ref in IronRuby? I'm 100% sure we can't
implement it without slowing down the entire runtime. ObjectSpace is a
thin wrapper around MRI's memory manager, while on the CLR we don't have
access to it. Therefore, it's more MRI's implementation detail than a
general Ruby feature. And Ruby library writers already know not to use
it if they want to run on all Ruby implementations.


That being said, we could implement it poorly and require the user to
turn it on if they want to use it (like JRuby does: 
Space), but I don't see that as a priority feature. That being said,
patches are welcome. If you want to discuss this further, let's move
this discussion to the mailing list (ironruby-core at rubyforge.org) or
open a new feature request (



I think jimmysch is right about the performance issues, but in my case I
need to have the ObjectSpace.id2ref because we need to send the object
IDs to native languages and retrieve the objects using this object IDs
in IronRuby.

I think that the JRuby solution (
Space) should be in IronRuby.


I've attached my own trick (I think it is a big performance issue).
Maybe this could be done in a more better way and directly in IronRuby
source code.


Thank you!


PS: I would like to become a developer in this project. With who should
I talk?!




Iulian Fecioru


NAPA Romania SRL

Lead Software Developer


Brailei, 165b, 1



800310, Galati, Romania












-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20110810/4675cb18/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: object_space.rb
Type: application/octet-stream
Size: 1839 bytes
Desc: object_space.rb
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20110810/4675cb18/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: object.rb
Type: application/octet-stream
Size: 87 bytes
Desc: object.rb
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20110810/4675cb18/attachment-0003.obj>

More information about the Ironruby-core mailing list