Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Created Feb 1, 2021
Embed
What would you like to do?
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