Choosing the Right Memory Analyzer for Your Java Project: A Feature Checklist

Do you need a Java Memory Analyzer in your toolbox? Why? And how do you choose the right one for your situation?

A memory analyzer can streamline your development, avoid costly glitches in production and help you reduce your cloud service bills. It can allow your troubleshooting team to provide answers quickly, and help your developers make good decisions.

This article looks at a few popular Java Memory Analyzers, and discusses what you should look for when choosing the right tool.

Why Do We Need a Java Memory Analyzer?

A heap dump analyzer can help us in several ways. Here are a few.

  • Detect memory leaks and other memory-related issues;
  • Software debugging;
  • Provide accurate information in order to configure for optimum performance;
  • Detects memory wastage. This is particularly useful when writing software for small devices, or for the cloud, which charges according to resources used;
  • Compare different solutions for efficiency;
  • Evaluate new software versions to ensure new releases will not cause memory issues in production. In a fast-moving CI/CD pipeline, this is an important consideration.

What Memory Analyzer Tools are Readily Available?

In this article, we’ll look at four popular utilities, and highlight their strengths and weaknesses.

The tools we’ll evaluate are:

  • HeapHero: This tool is part of the yCrash suite;
  • Eclipse MAT: This is an independent tool developed by the Eclipse Foundation;
  • VisualVM: This is an open-source tool developed to replace JVisualVM, which was part of the earlier versions of JDK;
  • JHat: This was part of the JDK up to Java 8, but is not supported in later versions.

What Do We Need to Clarify Before Choosing a Memory Analyzer?

Before we start, we need to take a look at our organization, and decide what’s important to us and why.

Here are a few questions we should ask ourselves.

  • What version of Java are we using? Do we plan to upgrade it? How soon?
  • Do we have a CD/CI pipeline for development? If not, do we plan to implement one?
  • Do we use management tools such as Jira? Monitoring tools? Would we want to integrate the memory analyzer into these workflows?
  • How confidential is our data? Always remember that heap dumps contain live data. Sometimes this is highly confidential, for example credit card numbers. Sometimes it’s personal details that are regulated by the data protection laws. And sometimes it’s company data that we wouldn’t want our competitors to access. Heap dumps that are insecurely stored or transmitted are extremely vulnerable to hackers.
  • Where are our systems deployed? Many organizations will need software for several different platforms, which may include large servers, the cloud, desktop and small devices. They may run on different operating systems: Windows, Unix/Linux, Mac and Android.
  • Do any of your applications have very large memory requirements? If so, the heap dump will be very large.

What Features Do We Need in a Java Memory Analyzer?

The answers to this will, to some extent, depend on the answers you gave to the questions in the last section.

Let’s break down some of the areas we should look at when choosing the right tool.

1. Troubleshooting Capabilities

There are a few things that are essential in this area.

  • Identifying largest objects: This is the most useful feature, both for finding memory leaks and for seeing what objects are occupying too much space.
  • Examining outgoing and incoming references to explore the dominator tree. This narrows down what child objects are actually holding the memory, and what parent objects are preventing it from being garbage collected.
  • Retained Heap: This identifies how much memory is held by an object and all its children.

Other features which are useful include:

  • Highlighting leak suspects;
  • Identifying GC roots;
  • Class histogram;
  • Thread information;
  • Facility to use OQL (Object Query Language);
  • Use machine learning to make recommendations.

If any of your applications use more than a gigabyte of memory, it’s essential to choose an analyzer that copes well with large heap dumps.

HeapHero and Eclipse Mat are the most feature-rich in these areas.

2. Useful Statistics

When it comes to evaluating efficiency and also accessing good information for accurate performance tuning, it’s important to have information on how memory is being used and where. VisualVM, HeapHero and JHat include memory usage statistics.

If you’re running on devices that have limited memory, or are paying for memory usage in the cloud, you’ll need to ensure your applications are not wasting memory. Both HeapHero and Eclipse MAT analyze and report on wasted space.

3. Deployment Options

Deployment options may include on-premise, cloud, desktop and via API. It’s important to choose the option that suits you best. For security reasons, heap dumps should only be stored in well-secured locations to prevent hacking.  Since heap dumps can be large, it’s often better to be able to analyze them on the actual server where the application is running.

Eclipse MAT is somewhat limited in this area, since it will only run on a desktop or laptop. This means that technicians often copy sensitive heap dumps to their own machines for analysis, so security on these devices must be hack-proof.

4. Security

This is important in any installation, but critical for any systems that process confidential information. HeapHero excels in this area, due to its flexible deployment options, secure data transfer, and its ability to mask sensitive information on request.

5. Workflow Integration

We need to look at our existing workflows, and see whether the analyzer tool fits with the way we do things. Again, HeapHero has the best ability to integrate into team and organizational workflows.

  • It can be integrated with management and monitoring tools;
  • Team members can easily access analysis reports from a single central place, eliminating the need for team members to share heap dumps to carry out their own individual analysis;
  • Reports can be automatically compared with previous reports to monitor improvements;
  • The REST APIs make it simple to integrate memory analysis into CI/CD pipelines.

Comparison Summary

The table below summarizes how the four tools under discussion compare in the categories we’ve discussed.

Comparison Summary
 HeapHeroEclipse MATVisualVMJHat
Troubleshooting 
Highlight Leak Suspects
Interactively Explore Incoming/Outgoing References
Other: Histograms, thread info, GC roots, retained heapLimited FeaturesLimited Features
Object Query Language
Works well with large heap dumps
Include ML recommendations
Usage Statistics    
Used Heap Size
Memory usage stats by generational region
Wasted Space analysis
Deployment Options    
Desktop
Server
Secure Cloud
Via API
Security    
Masking Facility
On-server installation
Workflow Integration    
Integrate with CI/CD
Integrate with management and monitoring tools
Report Sharing
Compare reports

For more information on HeapHero’s advanced capabilities, see this article: How is HeapHero Different?

Conclusion

A good Java Memory Analyzer can help us make better decisions, cut costs and avoid downtime. It’s a must-have for developers, performance testers and troubleshooters.

Choosing the right tool can save us time, money and frustration. In this article, we’ve discussed what features you should look for in order to best fit in with your organization’s needs.

Share your Thoughts!

Up ↑

Index

Discover more from HeapHero – Java & Android Heap Dump Analyzer

Subscribe now to keep reading and get access to the full archive.

Continue reading