Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

weakref behavior

View gist:3017739
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
This is from the end of weakref.rb:
 
if __FILE__ == $0
# require 'thread'
foo = Object.new
p foo.to_s # original's class
foo = WeakRef.new(foo)
p foo.to_s # should be same class
ObjectSpace.garbage_collect
ObjectSpace.garbage_collect
p foo.to_s # should raise exception (recycled)
end
 
And this is the output from running it (no exception raised):
 
"#<Object:0x000001010b3ea0>"
"#<Object:0x000001010b3ea0>"
"#<Object:0x000001010b3ea0>"
 
Any thoughts on why? I haven't yet delved deeply into the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.