简体   繁体   English

Eclipse MAT 报告仅列出前 10 个对象

[英]Eclipse MAT report is only listing top 10 objects

I'm analyzing my heap using MAT and looking at a few helpful reports.我正在使用 MAT 分析我的堆并查看一些有用的报告。 For example this report lists the possible memory wastes in empty collections.例如,此报告列出了空 collections 中可能的 memory 废物。

MAT version: 1.11.0 MAT 版本:1.11.0

Here as you can see from the screenshot, each item in the report is only listing first 10 of all objects.正如您从屏幕截图中看到的那样,报告中的每个项目仅列出所有对象的前 10 个。

在此处输入图像描述

If I click into the "First 10 of... objects", expecting to see more objects, that's actually not the case.如果我点击“前 10 个...对象”,期望看到更多对象,实际上并非如此。 All I can see is only those 10 objects.我能看到的只有那 10 个对象。 I don't see a way to show more objects like a "Show the next 10 objects" button.我看不到显示更多对象的方法,例如“显示下一个 10 个对象”按钮。 See screenshot below.请参阅下面的屏幕截图。

在此处输入图像描述

I'm looking for a way to see all the 365 objects.我正在寻找一种查看所有 365 个对象的方法。 Is there such a button somewhere?某处有这样的按钮吗? Or I have to write OQL for that?或者我必须为此编写 OQL? I'm really new to OQL, could someone give me an example?我真的是 OQL 的新手,有人能给我举个例子吗? Appreciate any help!感谢任何帮助!

Note: The ThreadLocalMap is only for illustration and a better screenshot, I'm actually looking for where the empty HashMap are from.注意: ThreadLocalMap 仅用于说明和更好的屏幕截图,我实际上是在寻找空的 HashMap 的来源。

The reason MAT only has links for the first 10 objects is to keep down the size of the generated HTML page. MAT 只有前 10 个对象的链接的原因是为了减小生成的 HTML 页面的大小。 Having every object in the report could make the report massive.在报告中包含每个 object 会使报告变得庞大。 Sometimes the report has an icon with a window with a yellow arrow bext to the heading.有时,报告有一个带有 window 的图标,标题旁边有一个黄色箭头。 You can use that to run that section as a query.您可以使用它将该部分作为查询运行。

Memory Analyzer 1.12 has some improvements to the reports, but still the 10 object limit. Memory Analyzer 1.12 对报告进行了一些改进,但仍然是 10 object 限制。

If you are happy to know about HashMaps from the whole snapshot, then find them using the histogram query, then run the 'Java Collections' > 'Collections Grouped by Size'如果您很高兴从整个快照中了解 HashMap,则使用直方图查询找到它们,然后运行“Java 集合”>“按大小分组的集合”

If you want to look at HashMaps belonging to a component then that's harder.如果您想查看属于某个组件的 HashMap,那就更难了。 The root set of a component is defined by MAT as being a class loader, all the classes loaded by that loader, and all instances of those classes which are not themselves classes or class loaders.组件的根集由 MAT 定义为 class 加载器、由该加载器加载的所有类,以及那些本身不是类或 class 加载器的类的所有实例。 From the help:从帮助:

Using this root set of objects, the component report calculates a customized retained set.使用这个根对象集,组件报告计算一个定制的保留集。 This retained set includes all objects kept alive by the root set.该保留集包括由根集保持活动的所有对象。 Additionally, it assumes that all objects that have become finalizable actually have been finalized and that also all soft references have been cleared.此外,它假定所有已变为可终结的对象实际上已被终结,并且所有软引用也已被清除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM