Advertisement Header

Monday 11 June 2018

Analyzing large Java heap dumps using Memory Analyzer CLI in Linux

Description:

When you have a situation or need to analyze really large heap dump (like 30/40 GB), then most of the times MAT UI will fail to analyze such large files, in that case you can use Memory Analyzer CLI in Linux/Windows. In this post we will see how we use analyzer tool in Linux

Pre-req to setup 


  • Make sure you have enough physical / virtual (VM) memory available. (~at least equal to size of the file to make memory analyzer run smooth). 
  • Make Sure you have tool downloaded from here http://www.eclipse.org/mat/downloads.php 
  • Make sure you have necessary privileges or access on Linux system.

Steps to Follow



  • unzip download memory analyzer tool using unzip command 
    • unzip MemoryAnalyzer-1.7.0.20170613-linux.gtk.x86_64.zip
  • mat folder will be created then run "cd mat"
  • Run command to start dump analyzer
    • ./ParseHeapDump.sh /dumps/heap.date.bin ls -vmargs -Xmx40g -XX:-UseGCOverheadLimit
      • Xmx40g  - Here 40g represents allocated memory in GB for this process alter this as required.
      • /dumps/heap.date.bin - This file represent your dump file alter the filename with full path in it as required.
  • Above command will take time based on the size of the dump file and it will generate index files on the directory where your dump file exists
  • Now to generate html files run below command
    • ./ParseHeapDump.sh /dumps/heap.date.bin org.eclipse.mat.api:suspects
      • org.eclipse.mat.api:suspects - represents report type
      • Below are the other report types available
                              org.eclipse.mat.api:suspects
                org.eclipse.mat.api:overview
                org.eclipse.mat.api:top_components 



  • Above command will generate jvm_suspects.zip file which consists html files.
  • Now these html reports can be shared with anybody by scp/email/ftp as required.

No comments:

Post a Comment