使用Eclipse MAT分析20GB+的heap dump文件
最后解析出来dump size只有1GB+
Eclipse MAT的官方文档,《Basic Tutorial》章节,有对上图的Overview page做介绍
针对total size小于file size的情况,有专门说明:
If the total size of the dump is much smaller than the size of the file it is possible that the heap dump contained many ‘garbage’ objects which would be discarded at the next garbage collection. See the unreachable objects query to examine these ‘garbage’ objects.
翻译过来就是:
MAT对unreachable objects出现原因的分析:
jmap
命令获得)jmap -dump:format=b,file=file_name <pid>
Unreachable Objects Histogram
链接点击查看Query Browser
→
\rightarrow
→ Java Basics
→
\rightarrow
→ Unreachable Objects Histogram
,查看unreachable objects清理缓存:Window
→
\rightarrow
→ Heap Dump History
→
\rightarrow
→ 找到对应的heap dump文件
→
\rightarrow
→ 右键,Delete Index Files
允许MAT保留unreachable objects:Window
→
\rightarrow
→ Preferences
→
\rightarrow
→ Memory Analyzer
→
\rightarrow
→ 勾选'Keep unreachable objects'
→
\rightarrow
→ Apply and Close
重新打开heap dump文件,这次MAT将不会丢弃unreachable objects