【备忘】Eclipse内存泄漏分析工具MAT - Memory Analyzer Tools

下载

https://www.eclipse.org/mat/downloads.php

Linux上生成HeapDump

使用jdk的命令

/path/to/jdk/bin/jmap -dump:format=b, file=<文件名XX.hprof> <pid>

为MAT配置JDK11

MAT现在需要JAVA11,如果不希望改操作系统的JAVA_HOME等环境变量

下载JDK 11,解压,改名jre,放在MAT的文件夹内即可。

-vm
The location of Java Runtime Environment (JRE) to use to run the Eclipse platform. If not specified, the launcher will attempt to find a JRE. It will first look for a directory called jre as a >sibling of the Eclipse executable, and then look on the operating system path. Relative paths are interpreted relative to the directory that eclipse was started from.

-vm 运行Eclipse平台的JRE路径,如果没有定义,启动器会尝试查找。启动器首先会找可执行文件相同路径下的jre目录,然后从系统的path中查找。相对路径被解释为从Eclipse启动位置的相对目录。

文档地址:https://help.eclipse.org/latest/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/running_eclipse.htm

使用MAT分析

./ParseHeapDump.sh <文件名pid>.hprof org.eclipse.mat.api:suspects org.eclipse.mat.api:overview org.eclipse.mat.api:top_components

生成 xxxx_Leak_Suspects.zip, xxxx_System_Overview.zip, xxxx_Top_components.zip

可下载到本地电脑

例子

解压后打开 xxxx_Leak_Suspects/index.html

图中的对应的JAVA进程没有发生内存泄露。

主页

  • 没有内存泄露
    Memory Analyzer Tools

Problem Suspect 2 -> StackTraces

  • 说明线程忙于从Kafka中poll数据。
    Memory Analyzer Tools
posted @ 2022-10-18 14:22  一杯半盏  阅读(364)  评论(0编辑  收藏  举报