Last active
December 11, 2015 03:58
-
-
Save hanshasselberg/4541852 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
$ ruby --version | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0] | |
$ irb --version | |
irb 0.9.6(09/06/30) | |
$ irb | |
> a = "gc me" | |
=> "gc me" | |
> ObjectSpace.define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" }) | |
=> [0, #<Proc:0x007f9e2abb9200@(irb):3>] | |
> a = nil | |
> GC.start | |
=> nil | |
> ObjectSpace.garbage_collect | |
=> nil | |
> exit | |
Finalizer one on 70158648666720 |
$ ruby --version
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-darwin12.2.1]
$ irb --version
irb 0.9.6(09/06/30)
$ irb
> a = "gc me"
=> "gc me"
> ObjectSpace.define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
=> [0, #<Proc:0x007fcfa188e410@(irb):2>]
> a = nil
=> nil
> GC.start
Finalizer one on 70264872626760
=> nil
> ObjectSpace.garbage_collect
=> nil
> ^D
@coffeejunk Thanks! I'm going to upgrade then!
@coffeejunk It works!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What's going on?
I expect that either
GC.start
orObjectSpace.garbage_collect
is calling the finalizer - but thats happening only when I close the session.WHY?