【备忘】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 @   一杯半盏  阅读(432)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示