This feature lets you compare any two memory snapshots.
To locate memory leaks, consider using the object generations feature.
To compare snapshots:
When comparing memory snapshots, there is an option to choose objects of which reachability scopes to be included to the comparison results:
The Comparison tab with memory views Classes and Classes and packages will open. The views have 2 columns: Objects (+/-) and Size (+/-). These display the differences in object counts and sizes. Positive values mean that Snapshot 2 (the later memory state) has more objects and/or its objects have the bigger total size.
100% of size corresponds to the total size of all objects in the old snapshot. Likewise, 100% of count corresponds to the object count in the old snapshot.
Please note that memory snapshot comparison provides only object count and size difference, it cannot tell which particular objects have gone or have been created between the snapshots being compared. This is because an object in the JVM heap does not essentially have a persistent ID. An object identifier is valid in particular snapshot only, it is in fact the object's physical address which may alter when the garbage collector compacts the heap or moves objects between heap generations. To address this limitation and enable object identification, YourKit profiler offers the object generations feature whose implementation involves object tagging with the help of the JVMTI API.