Analyzing Large Java Heap Dumps Using Memory Analyzer CLI
Luke Hebert
- 2 minutes read - 242 wordsWhen you need to analyze a 30 or 40 GB heap dump, the MAT UI will most likely choke on the file size. The Memory Analyzer CLI, however, handles those monsters just fine on Linux. Below is the setup and the exact commands you need to parse a multi-gigabyte dump and produce shareable HTML reports.
Prerequisites
- Make sure you have enough physical or virtual (VM) memory available, at least equal to the size of the dump file, so the analyzer runs smoothly.
- Download the tool from Eclipse MAT.
- Confirm you have the necessary privileges or access to the Linux system.
Steps to Follow
Unzip the downloaded Memory Analyzer tool:
unzip MemoryAnalyzer-1.7.0.20170613-linux.gtk.x86_64.zipEnter the extracted directory:
cd matRun the command to start the dump analyzer:
./ParseHeapDump.sh /dumps/heap.date.bin -vmargs -Xmx40g -XX:-UseGCOverheadLimit-Xmx40gallocates 40 GB of memory to the process. Adjust this value to match your dump size./dumps/heap.date.binis the full path to your dump file. Replace it with your actual file path.
The command will take time proportional to the dump size. When it finishes, index files are generated in the same directory as your dump file.
Generate the HTML report:
./ParseHeapDump.sh /dumps/heap.date.bin org.eclipse.mat.api:suspectsorg.eclipse.mat.api:suspectsspecifies the report type. Other available report types include:org.eclipse.mat.api:suspects org.eclipse.mat.api:overview org.eclipse.mat.api:top_componentsThe command produces a
jvm_suspects.zipfile containing the HTML reports.Share those HTML reports with your team via SCP, email, FTP, or any other method that works for you.