JXRay is an offline heap analysis tool for Java. It takes a binary heap dump, analyses it and produces a report in rich HTML format. Here are the main advantages of JXRay:
Detecting common problems right away. JXRay analyzes the heap upfront for many known memory problems. The dump is checked for memory leaks and numerous other data inefficiencies (data duplication, suboptimal use of data structures, etc.). This is especially relevant for Android applications, where memory is tight. All significant problems are highlighted, and you see them immediately.
Knowledge of internals. JXRay has knowledge of implementation details of most of the common Java and Scala collections: maps (e.g. java.util.HashMap), lists (e.g. java.util.ArrayList) etc. That makes it possible to present results in a compact form, omitting the unnecessary collection implementation details. Also the tool accurately calculates how much memory is taken by the implementation of collections themselves.
Compact presentation. JXRay aggregates together all the identical reference chains, repeating data fields (think linked lists), similar GC roots, etc. The resulting compressed, clear presentation of even the biggest and most complex heaps allows you to easily understand where most memory goes, and match trees of objects with the code that generated them. In other words, you know immediately what code to change to get the biggest memory improvement.
No-frills tool. While it may seem counterintuitive, the fact that JXRay has no GUI and produces a semi-static HTML report, has clear advantages. You can easily run the tool on any machine, including big "headless" machines in the cloud. And once the report is generated, you can look at it anywhere at any time, send it by e-mail, attach to a JIRA ticket, share on the wiki, etc.
Battle-tested. JXRay has been used to identify and fix many real performance problems. Some of them were in Apache open source projects.
If you would like to learn more about the Java memory problems detected by JXRay, why they are so common and may waste a lot of memory, check these presentation slides