Created
February 1, 2021 20:43
-
-
Save tenderlove/3796921853fe1f2369bc56482eceb53e 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
require "objspace" | |
require "json" | |
def go x | |
count = GC.stat(:major_gc_count) | |
loop do | |
info = JSON.parse(ObjectSpace.dump(x)) | |
break if info["flags"]["old"] | |
GC.start | |
end | |
GC.stat(:major_gc_count) - count | |
end | |
p go(Object.new) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment