Forum: IronRuby ObjectSpace module

Posted by Iulian Fecioru (Guest)
on 2011-08-10 07:52
Attachment: object_space.rb (1,8 KB)
Attachment: object.rb (87 Bytes)
(Received via mailing list)
Hello,



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
objects.

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:
http://kenai.com/projects/jruby/pages/PerformanceT...
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@rubyforge.org) or
open a new feature request (
http://ironruby.codeplex.com/WorkItem/Create).

"



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 (
http://kenai.com/projects/jruby/pages/PerformanceT...
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?!



Regards,

________________________________

Iulian Fecioru



NAPA Romania SRL

Lead Software Developer



Brailei, 165b, 1





800310, Galati, Romania

Mobile:

+40-722-664027



Phone:

+40-336-802182





Fax:

+40-336-802185
Posted by Tomas Matousek (Guest)
on 2011-08-10 20:30
(Received via mailing list)
Your implementation of _id2ref might be a good enough approximation. (It 
isn't 100% equivalent to MRI though since in MRI I can enumerate 
integers and ask if there is an object with that id. So I can get to 
objects for which object_id wasn't called before.)

You "become" a developer by submitting a patch on github. No need to 
talk to anybody :). Of course, it is better to let folks in this list 
know what you're working on so that we don't dup efforts.

Tomas

From: ironruby-core-bounces@rubyforge.org 
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Iulian Fecioru
Sent: Tuesday, August 09, 2011 10:51 PM
To: ironruby-core@rubyforge.org
Subject: [Ironruby-core] ObjectSpace module

Hello,

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 
objects.
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: 
http://kenai.com/projects/jruby/pages/PerformanceT...), 
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@rubyforge.org<mailto:ironruby-core@rubyforge.org>) or 
open a new feature request 
(http://ironruby.codeplex.com/WorkItem/Create).
"

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 
(http://kenai.com/projects/jruby/pages/PerformanceT...) 
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?!

Regards,
________________________________
Iulian Fecioru



NAPA Romania SRL

Lead Software Developer



Brailei, 165b, 1





800310, Galati, Romania

Mobile:

+40-722-664027



Phone:

+40-336-802182





Fax:

+40-336-802185
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.