|
|
|
Back to newsletter 195 contents
I'm going to ask for your help again this month - and possibly educate you while I do. I was asked if I could provide a page of heap dump analysers alongside the other tools I list (see the menu line above starting with "Tools:" which starts with GC log analysers and ends with Thread analysers.
For anyone who doesn't know what a heap analyser is, you want to use one when you get a heap dump, so that you can analyse the objects you have in memory at the time of the dump. You can get a heap dump with both the live and dead objects (it won't GC first), or you can get a heap dump to first execute a full GC then dump, so that you only see the retained live objects. You'd want the latter to diagnose a memory leak, the former can be useful when you're trying to understand what garbage you're producing that may be churning your memory.
Getting a heap dump is straightforward, you can use any of jmap
; the
JMX com.sun.management.HotSpotDiagnostic.dumpHeap()
method (from any
JMX aware tool, such as jconsole); the -XX:+HeapDumpOnOutOfMemoryError
flag
(which does what it says); and jcmd [PID] GC.heap_dump [PATH_TO_DUMPFILE]
.
(As an aside, rather than doing a full dump and using an analyser, you
can often get away with doing just a couple of jmap -histo
calls
and comparing the output in a spreadsheet to find out what objects
you're leaking or churning, -histo
also supports a live option,
ie -histo:live
).
Heap dumps analysers (ie tools that will load a heap dump and then let you investigate what is in memory) that I know about are: jhat (discontinued in Java 9), JVisualVM, Eclipse MAT, the JOverflow plugin in JMC (Java Mission Control), jxray. I know that there are also a bunch of commercial profilers (like JProfiler) that include heap dump analysis capability (if you want yours to get into the new "Heap dumps analysers" page, please tell me). If you know about any other analysers you've used, please tell me - and then in turn I'll tell all of you when I create that page and add it to my Tools listed at the top of the page.
Heap dumps analysers are pretty good nowadays, with sensible "wizard" like capability to suggest what is causing a memory leak if that's what you're using it for - and I'd guess that's the most frequent use for analysing heap dumps.
Now on to our links to tools, articles, news, talks, blogs. And if you need the tips from this month's articles and talks, as ever they are extracted into this month's tips page.
Java performance tuning related news.
Java performance tuning related tools.
Back to newsletter 195 contents