From: jean.boussier@... Date: 2020-08-12T12:31:55+00:00 Subject: [ruby-core:99570] [Ruby master Feature#17103] Add a :since option to ObjectSpace.dump_all Issue #17103 has been updated by byroot (Jean Boussier). @ko1 this parameter allow to do partial heap dumps. e.g. `dump_all(since: 42)`, means to only dump objects of the 42th generation and later. Basically like adding a `if ObjectSpace.allocation_generation(obj) >= 42`. This would be very useful to me, because a minimal heap dump of our application is over 1GiB and take almost a minute to be performed. Often times I'm only interested by allocations past a certain point, such filtering criterias would allow for much smaller and faster dumps, with less "noise" in them. Please let me know if that is still unclear. > also https://github.com/ruby/ruby/pull/3368/files doesn't have a doc. That's an oversight on my part, I'll update the PR to add a documentation for that new parameter as soon as possible. ---------------------------------------- Feature #17103: Add a :since option to ObjectSpace.dump_all https://bugs.ruby-lang.org/issues/17103#change-87037 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal ---------------------------------------- Patch: https://github.com/ruby/ruby/pull/3368 This is useful for seeing 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 that I have to dump the entire heap 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-generation dumps without doing the diff. -- https://bugs.ruby-lang.org/ Unsubscribe: