Skip to content

@authorNari /bm_gc_deep.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# create objects that have deep references.
GC::Profiler.enable
depth = ARGV.pop
depth ||= 240
depth = depth.to_i
def make_deep_obj(parent, level, max)
if level > max
parent << "e".dup
return
end
parent << []
make_deep_obj(parent.last, level+1, max)
end
@roots = []
100000.times do
a = []
make_deep_obj(a, 0, depth)
@roots << a
end
GC::Profiler.report
p GC::Profiler.total_time
p GC.count
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.