登錄系統(注意這里啟動 tomcat 的用戶)
# 獲取 tomcat 的 pid 號
ps -ef|grep tomcat
# 例如這里 pid 號為 13133
jmap -dump:live,format=b,file=dump.hprof 13133
使用 MAT 分析
# MAT 下載地址:https://www.eclipse.org/mat/downloads.php
# 我這里下載的 windows 版本,解壓后,按需更改 MemoryAnalyzer.ini 里面的配置,我改成了 4G 大小
下載 dump.hprof ,使用 MAT 打開分析