Created
January 11, 2011 20:41
-
-
Save jlindley/775089 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bar | |
def self.anon_struct | |
s = Struct.new(:foo, :bar, :baz) | |
oid = s.object_id | |
s = nil | |
oid | |
end | |
end | |
GC.start | |
oid = Bar.anon_struct | |
puts "Object id #{oid}:" | |
puts ObjectSpace._id2ref(oid).inspect | |
# | |
# OUTPUTS | |
# | |
# Object id 2151904380: | |
# <Class:0x0000010086e8f8> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment