From my own experience, OutOfMemoryError are often due to a "Collection" instance retaining all objects in Java Heap. We all have our recipe to deal with OOME. Mine is quite simple, I get the dominator tree view, and I go down all the levels as long as the retained heap is high. And I often found an API Collection instance as java.util.List, java.util.Set or java.util.Map.
This plugin provides a new view Collection tree
You can access it with this new action in toolbar:
This view is quite similar to the Dominator Tree For each object, you have its size if it's a Collection, retained heap and percentage of total heap used.
View uses default IClassSpecificNameResolver instances to display name as in the Dominator Tree. However "Collection" instances like java.util.List, java.util.Set or java.util.Map are displayed differently to show the refered field in the problematic class.
In example : You can see that field Collection values in class com.github.qlefevre.eclipse.mat.test.heapdump.BagB retains 37.81% of total heap. Instance java.util.HashSet has 63404 elements and retains 8.24 MB.
You can download a prepackaged version with eclipse-mat-easy plugin already installed : Windows(x86_64) Linux(x86_64)
Note for Memory Analyzer 1.7.0: you must disable "Eclipse Oxygen" update site before installing plugins otherwise your MAT installation will get broken.
To disable Eclipse Oxygen in MAT 1.7.0, perform the following:
- Open MAT Settings
- Open
Install/Update
,Available Software Sites
- Uncheck
Eclipse Oxygen
- Click
Ok
Use the following update repository to install the latest released version: http://github.com/qlefevre/eclipse-mat-easy/raw/master/com.github.qlefevre.eclipse.mat.easy.updatesite
To install Eclipse MAT Easy plugin, perform the following:
- Open
Help
,Install New Software...
- For MAT 1.7.0: in case you have not disabled Eclipse Oxygen update site, click
Available Software Sites
and disable Oxygen there - Click
Add
, it will open aAdd Repository
window - Type
Eclipse MAT Easy update site
to theName
field - Type
http://github.com/qlefevre/eclipse-mat-easy/raw/master/com.github.qlefevre.eclipse.mat.easy.updatesite
to theLocation
field - Click
Ok
- All the checkboxes can be left by default (
Show only latest version
,Group items by category
, ...) - Check
Eclipse MAT Easy !
category - Click
Next
(Available Software) - Click
Next
(Installation Details) - Accept License
- Click
Finish
and restart MAT
The following update site can be used to get development builds: http://github.com/qlefevre/eclipse-mat-easy/raw/master/com.github.qlefevre.eclipse.mat.easy.updatesite