This is useful for seeing what a block of code allocated, e.g.
GC.startGC.disablegc_gen=GC.countObjectSpace.trace_object_allocationsdo# run some codeendallocations=ObjectSpace.dump_all(output: :file,since: gc_gen)GC.enableGC.startretentions=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.
@ko1 (Koichi Sasada) 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.
this feature strongly connected with trace_object_allocations, right? so please write it on document.
what happens on without trace_object_allocations? it is unclear.
I missed "allocation tracing disabled are not dumped" sentence. And changed version is more helpful.
Now I don't have any objection.
One suggestion is, "since" integer is not clear yet (even if trace_object_allocations describes it), so it is helpful to explain it is integer from GC.count.