Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy-to-use performance and memory .NET profiler for Windows, Linux and macOS.
Secure and easy profiling in cloud, containers and clustered environments.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Comparing memory snapshots

While capturing a single memory snapshot can provide invaluable information, comparing multiple snapshots can deliver insights into how memory is being used over time. By systematically capturing and comparing key metrics before and after changes, you can scientifically measure the impact of your optimizations, thereby turning the often murky waters of performance tuning into a more clear-cut, data-driven activity.

How to compare memory snapshots

To compare snapshots, do the following:

  1. Open two memory snapshots you want to compare.
  2. Select one of them.
  3. Use File | Compare Snapshot with... (also available from the popup menu) and select the snapshot to compare with.

A new tab with the comparison opens. It contains Classes and Classes and namespaces views displaying two columns: Objects (+/-) and Size (+/-). These columns show 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.

memory snapshot comparison

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.

Why is comparing useful?

  1. Identifying memory leaks: By comparing two memory snapshots, you can identify objects that are unnecessarily consuming memory and potentially causing leaks.
  2. Spotting trends: Comparing multiple snapshots allows you to spot trends and anomalies that may not be apparent in a single snapshot.
  3. Regression analysis: Facilitates identifying performance regressions when new versions are released.

When to compare memory snapshots

  1. After deploying fixes: To validate that a memory leak or other issue has been resolved.
  2. During peak load: Comparing snapshots before, during, and after peak load conditions can reveal how your application behaves under stress.
  3. Periodically during long-running processes: This helps to ensure that memory consumption remains stable over time.

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.