如何使用堆转储识别Java Memory Analyzer中对象的引用持有者 [英] How to identify holder of reference to object in Java Memory Analyzer using heap dump

查看:554
本文介绍了如何使用堆转储识别Java Memory Analyzer中对象的引用持有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我对应用程序的OutOfMemoryErrors有一些问题,我想确定根本原因。
这我从AIX服务器上的IBM VM创建了一个堆转储(PHD),并尝试使用IBM Support assistant 4.1及其Memory Analyzer工具对其进行分析。

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 tried to analyze it using IBM Support assistant 4.1 and its Memory Analyzer tool.

解析堆转储时,ISA会询问我是否要运行泄漏可疑报告。

When the heap dump is parsed ISA asks me if i want to run the leak suspect report.

使用泄漏方面支持我获得了有关消耗的某些类的信息相当多的内存。

Using the leak respect support i got the information about some classes which consume considerable amount of memory.

我现在想要识别的是对象引用的持有者,但我可以例如只查看ArrayList包含的对象,但不知道谁拥有对该ArrayList的引用。

What i now want to identify is the holder of the object references, but i can e.g. only see what objects a ArrayList contains, but not who holds a reference to that ArrayList.

我如何获取该信息?

推荐答案

在内存分析器(MAT)中加载堆转储。

Load you heap Dump in Memory Analyzer (MAT).


转到直方图并查看大尺寸对象。

Go to Histogram and see the big size Object.


现在右键单击此选项并选择立即支配者。它会打开一个支配树,你可以识别出你的物体是什么。

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

有时,当大尺寸对象是局部变量时,您将无法在树中看到直接的支配者。它只能告诉你你的变量是哪个线程的一部分。(图片下方没有显示这个局部变量的情况)

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)

在这种情况下检查(堆栈跟踪)你在哪里得到OutOfMemoryError。然后相应地向后追踪并尝试找出在哪种方法中创建大尺寸对象作为局部变量。大多数情况下,我们在同一方法中获得大尺寸对象,这在堆栈跟踪中显示为某些时间点,而在分配更多内存时我们得到OutOfMemoryError。

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.

更多详情。

这篇关于如何使用堆转储识别Java Memory Analyzer中对象的引用持有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆