【备忘】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启动位置的相对目录。
使用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进程没有发生内存泄露。
主页
- 没有内存泄露
Problem Suspect 2 -> StackTraces
- 说明线程忙于从Kafka中poll数据。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!