amccreight / heapgraph

Analysis of Firefox cycle collector and garbage collector heap graphs
24 stars 16 forks source link

Teach the GC analyzer how to coalesce better #18

Open khuey opened 10 years ago

khuey commented 10 years ago

It seems to report multiple paths like so:

root_1 -> stuff -> common_subtree root_2 -> moar_stuff -> common_subtree root_3 -> even_moar_stuff -> common_subtree

It would be really nice if we only reported common_subtree.

amccreight commented 10 years ago

Yeah, we really need some kind of dominator analysis. I think that's the usual approach to showing interesting stuff. A dominates B if all paths to B go through A. I think that would help with what you are talking about?

The --simple-path option also helps a bit when you have to dig through a ridiculous number of paths. You can then sort it and run uniq on it (with the option that shows how many times each path showed up).

khuey commented 10 years ago

The CC log analyzer seems to find the shortest path to a root via each of the incoming edges of an object and only print that path. Could we do the same for the GC log?

amccreight commented 10 years ago

I think the algorithms are the same (copy and pasted most likely), but the traversal algorithms in the logging code itself is very different. The GC logger just iterates over everything in the order they appear in memory, so it isn't too surprising the results are junkier. I guess it is possible that the CC code does slightly better pruning somehow. It has been quite a while since I looked at that part of the code. But yes, we should make it better!