Skip to content

Instantly share code, notes, and snippets.

@jc00ke
Last active August 29, 2015 14:12
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 jc00ke/2e1581099df61ff644ff to your computer and use it in GitHub Desktop.
Save jc00ke/2e1581099df61ff644ff to your computer and use it in GitHub Desktop.
Symbol GC object ids
>> s = "sym1".to_sym
=> :sym1
>> s.object_id
=> 70102969563660
>> GC.start
=> nil
>> s = "sym1".to_sym
=> :sym1
>> s.object_id
=> 70102969563660
obj = Object.new
100_000.times do |i|
obj.respond_to?("sym#{i}".to_sym)
end
puts :sym1.object_id
GC.start
puts "sym1".to_sym.object_id
@jc00ke
Copy link
Author

jc00ke commented Dec 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment