如何用月食分析MAT [英] How to analyze MAT with eclipse

查看:324
本文介绍了如何用月食分析MAT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Web应用程序正在apache tomcat中运行.

My web application is running in apache tomcat.

类加载器/组件org.apache.catalina.loader.WebappClassLoader @ 0x7a199fae8占用1,70,86,32,104(88.08%)字节.

The classloader/component org.apache.catalina.loader.WebappClassLoader @ 0x7a199fae8 occupies 1,70,86,32,104 (88.08%) bytes.

内存是在<system class loader>加载的java.util.concurrent.ConcurrentHashMap$Segment[]的一个实例中累积的.

The memory is accumulated in one instance of java.util.concurrent.ConcurrentHashMap$Segment[] loaded by <system class loader>.

我在分析堆转储时遇到了这个问题.如何进一步分析?

I got this problem while analyzing Heapdump. How to analyze it further ?

推荐答案

您提供的信息很少,所以我只能提供很少的建议…;-)

You provide very little information so I only can provide very little advice… ;-)

首先,您需要找出谁在使用最大的对象(本例中为HashMap).尝试查看HashMap的内容,以便了解其用途.您还应该尝试查看在何处引用了这些对象.

First you need to find out who is using the largest objects (the HashMap in your case). Try to look at the contents of the HashMap so you may find out what it is used for. You should also try to look at where this objects are referenced.

比您可以尝试限制其大小.根据您使用的框架还是您自己的代码使用它,这可能很容易(例如,更改框架缓存的配置),中等(例如,您需要重构自己的代码)或困难(例如,它被深深地埋在里面)一个您无法控制的图书馆.

Than you can try to limit its size. Depending on whether it is used by a framework you use or by your own code this can be easy (e.g. configuration change for a frameworks cache), medium (e.g. you need to refactor your own code) or difficult (e.g. it is deeply buried in a library you have no control over).

罪魁祸首通常不是您所期望的:仅因为一个对象实例(在您的情况下为HashMap)积累了很多内存,并不意味着该对象的所有者"是问题的根本原因.您可能必须在对象树的上方或下方或甚至在完全不同的位置中查找一些级别.在大多数情况下,非常了解您的应用程序至关重要.

Often the culprit is not the one you expect: Only because an object instance (in your case the HashMap) accumulates a lot of memory does not mean the "owner" of this object is the root cause of the problem. You might well have to look some levels above or below in the object tree or even in a completely different location. In most cases it is crucial that you know your application very well.

更新:您可以尝试通过右键单击HashMap的内容,然后选择 Java集合哈希条目来检查其内容.对于常规对象,您可以使用列出对象与传入引用(列出所有引用所选对象的对象)或与传出引用(用于列出所选对象引用的所有对象.

Update: You can try to inspect the contents of a HashMap by right clicking it and selecting Java Collections, Hash Entries. For general objects you can use List objects, with incoming references (to list all objects that reference the selected object) or with outgoing references (to list all object that are referenced by the selected object).

内存分析不是一件容易的事,并且可能需要很多时间,至少在您不习惯的情况下……

Memory analysis is not an easy task and can require a lot of time, at least if you are not used to it…

如果您需要进一步的帮助,则需要提供有关您的应用程序,使用的框架以及堆在MAT中的外观的更多详细信息.

If you need further assistance you need to provide more details about your application, the frameworks you use and how the heap looks like in MAT.

这篇关于如何用月食分析MAT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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