perf-tools icon indicating copy to clipboard operation
perf-tools copied to clipboard

Dumping the entire dynamic heap

Open HertzDevil opened this issue 9 months ago • 0 comments

MemProf.log_object_sizes can be extremely slow if all the objects on the heap are highly interconnected, because running a BFS for every pointer must have at least quadratic time complexity.

If it is possible to dump the contents of the entire dynamic heap to an external file, then we could perform analysis on that dump instead, minimizing the impact on the running process. Only pointers would be included in an object's dump; non-atomic fields do not affect garbage collection, so they can be omitted.

This assumes such a dump can be performed in sub-quadratic time. This should indeed be the case because no traversal is needed; it is the responsibility of the external tools to rebuild the heap graph.

HertzDevil avatar Sep 19 '23 17:09 HertzDevil