Clone this repo:
  1. 9be492d Merge pull request #16 from square/jrod/update-plugins by Jesse Wilson · 1 year, 10 months ago master
  2. 923215b Upgrade plugins by John Rodriguez · 1 year, 10 months ago jrod/update-plugins
  3. 95fcc32 [maven-release-plugin] prepare for next development iteration by John Rodriguez · 2 years ago
  4. ecf8ff9 [maven-release-plugin] prepare release haha-2.0.3 by John Rodriguez · 2 years ago haha-2.0.3
  5. aeb5aed Merge pull request #14 from square/prep-2.0.3 by John Rodriguez · 2 years ago

Headless Android Heap Analyzer

“Ha Ha!” - Nelson


HAHA is a Java library to automate the analysis of Android heap dumps.

This project is essentially a repackaging of the work of others to make it available as a small footprint Maven dependency.


To learn how to dump the heap, read the Android documentation. Here's an example:

File heapDumpFile = ...

After dumping the heap, use HAHA to parse and analyze it.

HprofBuffer buffer = new MemoryMappedFileBuffer(heapDumpFile);
HprofParser parser = new HprofParser(buffer);
Snapshot snapshot = parser.parse();

// The rest is up to you.
ClassObj someClass = snapshot.findClass("com.example.SomeClass");

Gradle config

dependencies {
  compile 'com.squareup.haha:haha:2.0.3'


HAHA 2.0.*

  • This library contains parts of perflib and is available under the same license, Apache v2.
  • It contains a repackaged version of Guava and Trove4j “1.1 with patches from JetBrains”
  • Trove4j is available under the LGPL 2.1 license.
  • The result is merged in an uber-jar proguarded to remove unused code and reduce the footprint.

HAHA 1.1, 1.2 and 1.3

  • The first versions of HAHA were the result of a series of forks:
  • Eclipse Memory Analyzer (MAT) is a Java heap analyzer. It's a standalone GUI built with Eclipse RCP that embeds an engine to parse and analyze heap dumps.
  • vshor/mat is a fork of Eclipse Memory Analyzer. It removed a lot of code and changed some of it to make a headless version (no GUI), as well as ignore weak references when finding paths to GC Roots.
  • AndroMAT is a fork of vshor/mat and changed the heap dump parsing to support Android specific heap dump format.
  • HAHA was originally a fork of AndroMAT. We recreated the lost Git history, kept the bare minimum needed code and packaged it to be releasable on Maven Central.
  • MAT is available under the Eclipse Public License v1.0 so HAHA was initially released under that same license.