Last active
February 16, 2019 10:35
-
-
Save yhara/502e351332d893cd020466d28d373ac0 to your computer and use it in GitHub Desktop.
This file contains 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
HOOK = proc{} | |
class A | |
def foo | |
ObjectSpace.define_finalizer self, HOOK | |
end | |
end | |
A.new.foo | |
10.times{GC.start} | |
p ObjectSpace.each_object(A).to_a #=> [#<A:0x00007fbae28ef1f8>] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment