How to find memory problems

This cheat sheet provides some guidelines how the Memory Analyzer tool could be used to find memory problems.

Analysis steps overview

1. Get a quick overview of the heap
2. Search for single objects with big retained size - it is easy to analyze them afterwards
3. Search for groups of objects with big retained size - if there are no huge single objects, try to form different groups with as few as possible objects inside

1. Get a quick overview

As a starting point of the analysis get a quick overview.

2. Search for and explore the biggest objects

Open the dominator tree and look at the biggest objects. If there are some objects with too big retained size, do the following:

3. No huge single objects? Try to find suspicious object groups

If the dominator tree does not contain any objects which have a very big retained size, then try to find groups of objects which occupy a lot of memory.
Usually smaller groups are easier to further analyze.

3.1. Grouping objects

Here are several ideas of how to find interesting object groups

3.2. Analyzing object groups

Once you have found a suspicious group of objects, you can use one of the following for further analysis