1.安装unzip和zip
yum install -y unzip zip
2.安装wget
yum -y install wget
3.下载最新版本mat
wget http://eclipse.stu.edu.tw/mat/1.11.0/rcp/MemoryAnalyzer-1.11.0.20201202-linux.gtk.x86_64.zip
4.解压进入到mat目录下修改最大内存,根据hprof文件大小进行修改
vi MemoryAnalyzer.ini
5.对目标hprof文件进行分析并生成zip包,3个zip包默认生成的目录在hprof文件下
运行分析命令,添加三个压缩参数:
org.eclipse.mat.api:suspects org.eclipse.mat.api:overview org.eclipse.mat.api:top_components
分析命令如下
./ParseHeapDump.sh /data/outm/tch/java_pid22397.hprof org.eclipse.mat.api:suspects org.eclipse.mat.api:overview org.eclipse.mat.api:top_components
6.生成后会在java_pid22397.hprof所在文件目录下生成3个zip压缩包,将它们下载到电脑,使用浏览器进行查看即可