Couldn't understand - Why does `ObjectSpace._id2ref` giving different
type of output on `Ruby 1.9.3p392` and `Ruby 2.0p0` ?
***Ruby 1.9.3p392***
C:\>ruby -v
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]
C:\>irb --simple-prompt
>> class Foo ; end
#=> nil
>> Foo.object_id
#=> 17569464
>> ObjectSpace._id2ref(17569464)
#=> Foo
>> Foo.new.singleton_class
#=> #<Class:#<Foo:0x2041830>>
>> Foo.new.singleton_class.object_id
#=> 17075124
>> ObjectSpace._id2ref(17075124)
#=> "\x00"
***Ruby 2.0.0p0***
C:\>ruby -v
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]
C:\>irb --simple-prompt
DL is deprecated, please use Fiddle
>> class Foo ; end
#=> nil
>> Foo.object_id
#=> 17197176
>> ObjectSpace._id2ref(17197176)
#=> Foo
>> Foo.new.singleton_class.object_id
#=> 19181436
>> ObjectSpace._id2ref(19181436)
#RangeError: 0x124af7c is recycled object
# from (irb):5:in `_id2ref'
# from (irb):5
# from C:/Ruby200/bin/irb:12:in `<main>'
>> Foo.new.singleton_class.object_id
#=> 17454324
>> ObjectSpace._id2ref(17454324)
#RangeError: 0x10a54f4 is not id value
# from (irb):7:in `_id2ref'
# from (irb):7
# from C:/Ruby200/bin/irb:12:in `<main>'
>> Foo.new.singleton_class.object_id
#=> 17139816
>> ObjectSpace._id2ref(17139816)
#=> "c"
on 2013-03-17 09:41
on 2013-03-17 09:47
already fixed in ruby-trunk and before you ask, yeah the object_id of nil is changed in ruby-trunk too
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
Log in with Google account | Log in with Yahoo account
No account? Register here.