Introduction
Before looking into the capabilities that Memory Analyzer offers in the area of comparison let us make some explanation. Object IDs which are provided in the heap dump formats supported by MAT are just the addresses at which the objects are located. As objects are often moved and reordered by the JVM during a GC these addressed change. Therefore they cannot be used to compare the objects. This basically means that if one compares two different heap dumps (although from the same process) it is not possible to point to the concrete objects different between the two heap dumps. However, one can still perform comparison on the aggregated results (e.g. the class histogram) and analyze how the amount of object and the memory they take has changed.
Memory Analyzer offers the possibility to compare not only the global class histograms of two different heap dumps, but an arbitrary number of table-formatted or tree-formatted results - for example the retained sets of three different objects. It doesn't matter if the tables or trees which are compared come from one and the same or different heap dumps.
Here is a quick description how to compare several retained set tables.