【備忘】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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章