JXRay is a memory analysis tool for Java. It takes a JVM heap dump (.hprof file), 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 is the only tool that 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. With this, the heap structure is presented in a compact form, omitting the unnecessary collection implementation details. The tool accurately calculates how much memory is taken by the implementation of collections themselves vs their workload.
Compact presentation. JXRay aggregates 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. You can quickly figure out what code needs to be changed 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. See some Apache open source projects investigated and improved with JXRay.
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.
For in-depth understanding of how Java applications can waste memory, and how to prevent that, check the following articles:
How to Prevent Your Java Collections from Wasting Memory
Duplicate Strings: How to Get Rid of Them and Save Memory