Feature #17103
Updated by sawa (Tsuyoshi Sawada) over 4 years ago
Patch: https://github.com/ruby/ruby/pull/3368 This is useful for seeing to see what a block of code allocated, e.g. ```ruby GC.start GC.disable gc_gen = GC.count ObjectSpace.trace_object_allocations do # run some code end allocations = ObjectSpace.dump_all(output: :file, since: gc_gen) GC.enable GC.start retentions = ObjectSpace.dump_all(output: :file, since: gc_gen) ``` For context, context this is what I do in https://github.com/Shopify/heap-profiler, except that I have to dump the entire heap three times times, and then do a diff. This new API would allow me to dump the entire heap only once once, and then do two much-faster single-generation dumps without doing much faster single generations dumps, and avoid having to do the diff.