Recently, I've been digging in to JVM heap dumps using Eclipse MAT. I like it, but the one feature that I seem to use the most is the Dominator Tree. Eclipse's example screenshot:
Anyways, I find that a lot of the time, I usually get the most value out of just looking at that table and getting the first few entries. Since the turnaround time for getting this is:
- Create Heap Dump (
jcmd <pid> GC.heap_dump
) - Download/Pull heapdump to a location (MAT isn't installed on our servers)
- Run Eclipse MAT's
ParseHeapDump.sh
tool to build the various trees - Open MAT, click Dominator Tree icon.
- Analyze
Is there a way to get this equivalent information off of a running JVM programmatically? I'd like to run some kind of gather_dominators.sh <pid>
script on a host and get the Top X Objects from a JVM, but I don't know where to start.