How to identify holder of reference to object in Java Memory Analyzer using heap dump

后端 未结 1 1460
北海茫月
北海茫月 2020-12-11 06:54

As i have some problems with OutOfMemoryErrors with an application i want to identify the root cause. This i created a heap dump (PHD) from the IBM VM on the AIX server and

相关标签:
1条回答
  • 2020-12-11 07:06

    Load you heap Dump in Memory Analyzer (MAT).

    enter image description here Go to Histogram and see the big size Object.

    enter image description here Now right click on this and select Immediate dominators. It will open a dominator tree and u can identify what is holding your object.

    enter image description here

    Sometimes when the big size object is local variable you will not be able to see immediate dominators in tree. It can only tell you that your variable is part of which thread.(Below image doesn't show this local variable scenario)

    enter image description here

    In that case check (stack trace ) where are you getting OutOfMemoryError. Then accordingly trace it backwards and try to find out in which method are you creating big size objects as local variables. Most of the cases we get big size objects in same method which is shown in stack trace as at some point of time while allocating more memory we get OutOfMemoryError.

    More details.

    0 讨论(0)
提交回复
热议问题