From: jean.boussier@... Date: 2020-08-04T08:26:56+00:00 Subject: [ruby-core:99474] [Ruby master Feature#17103] Add a :since option to ObjectSpace.dump_all Issue #17103 has been reported by byroot (Jean Boussier). ---------------------------------------- Feature #17103: Add a :since option to ObjectSpace.dump_all https://bugs.ruby-lang.org/issues/17103 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal ---------------------------------------- Patch: https://github.com/ruby/ruby/pull/3368 This is useful 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 this is what I do in https://github.com/Shopify/heap-profiler, except I have to dump the entire three times, and then do a diff. This new API would allow me to dump the entire heap only once, and then do two much faster single generations dumps, and avoid having to do the diff. -- https://bugs.ruby-lang.org/ Unsubscribe: