0

I'm analyzing my heap using MAT and looking at a few helpful reports. For example this report lists the possible memory wastes in empty collections.

MAT version: 1.11.0

Here as you can see from the screenshot, each item in the report is only listing first 10 of all objects.

enter image description here

If I click into the "First 10 of ... objects", expecting to see more objects, that's actually not the case. All I can see is only those 10 objects. I don't see a way to show more objects like a "Show the next 10 objects" button. See screenshot below.

enter image description here

I'm looking for a way to see all the 365 objects. Is there such a button somewhere? Or I have to write OQL for that? I'm really new to OQL, could someone give me an example? 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.

OrlandoL
  • 898
  • 2
  • 12
  • 32

1 Answers1

0

The reason MAT only has links for the first 10 objects is to keep down the size of the generated HTML page. Having every object in the report could make the report massive. Sometimes the report has an icon with a window with a yellow arrow bext to the heading. 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.

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'

If you want to look at HashMaps belonging to a component then that's harder. 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. 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.

user13762112
  • 401
  • 3
  • 7