Skip to content

Instantly share code, notes, and snippets.

@bjeanes
Created April 5, 2009 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjeanes/90427 to your computer and use it in GitHub Desktop.
Save bjeanes/90427 to your computer and use it in GitHub Desktop.
>> (1..10).map(&:object_id)
=> [3, 5, 7, 9, 11, 13, 15, 17, 19, 21]
>> (-10..-1).map(&:object_id)
=> [-19, -17, -15, -13, -11, -9, -7, -5, -3, -1]
>> ObjectSpace._id2ref(-1)
=> -1
>> ObjectSpace._id2ref(-5)
=> -3
>> ObjectSpace._id2ref(-2) # if -2 = 0xfffffffe, then -1 == 0xffffffff
RangeError: 0xfffffffe is not id value
from (irb):66:in '_id2ref'
from (irb):66
>> 0xffffffff
=> 4294967295 # maximum number of objects in Ruby?
>> ObjectSpace._id2ref(4294967295)
=> -1
>> ObjectSpace._id2ref(-1)
=> -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment