Giter VIP home page Giter VIP logo

haha's Introduction

No Maintenance Intended

Headless Android Heap Analyzer

“Ha Ha!” - Nelson

This repository is DEPRECATED

  • This project was created to provide a heap dump parser for LeakCanary by repackaging heap dump parsers from other repositories.
  • LeakCanary now has its own heap dump parser.
  • That parser is available on Maven Central as com.squareup.leakcanary:leakcanary-haha:2.0-alpha-1.

Introduction

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.

Usage

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

File heapDumpFile = ...
Debug.dumpHprofData(heapDumpFile.getAbsolutePath());

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

DataBuffer buffer = new MemoryMappedFileBuffer(heapDumpFile);
Snapshot snapshot = Snapshot.createSnapshot(buffer);

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

Gradle config

dependencies {
  compile 'com.squareup.haha:haha:2.1'
}

Versions

HAHA 2.1

HAHA 2.0.4

This release separates out Trove4j from HAHA since Trove4j is available under LGPL 2.1 and HAHA is available under Apache 2.

  • This library contains parts of perflib and is available under the same license, Apache v2.
  • It contains a repackaged version of Guava
  • It has an artifact dependency on a fork of Trove4j ("1.1 with patches from JetBrains") which is available in jcenter under the LGPL 2.1 license.
  • The result is merged in an uber-jar (perflib + guava) proguarded to remove unused code and reduce the footprint.

HAHA 2.0, 2.0.1, 2.0.2, 2.0.3

  • 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.

Releasing

mvn release:prepare && mvn release:perform

haha's People

Contributors

joebowbeer avatar johnjohndoe avatar jrodbx avatar nicholasdower avatar pyricau avatar swankjesse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haha's Issues

Add correct sources to maven's source jar

The current source jar contains classes under their original packages, not the renamespaced one (e.g. com/android/tools/perflib/heap/ArrayInstance.java instead of com/squareup/haha/perflib/ArrayInstance.java).

This means that IntelliJ shows decompiled classes instead of real sources, and people who want to make source modifications can't rebuild from the source jar.

Joiner Guava Class Compiler Error

When using 'com.squareup.leakcanary:leakcanary-android:1.4-beta2' I get the following errors each time I build the app. The app still builds just fine, but the errors do appear each time I build:

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.base.Joiner$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.collect.Iterables$2) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.collect.Iterables$3) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.

Why haha 2.0.4 includes an old version of perflib

@pyricau Appologies first as this might be a beginner's question.

I saw Snapshot.computeDominators method in haha 2.0.4 is a very old version(the old version had a TODO: "Break dominator computation into fixed chunks, because it can be unbounded/expensive.").

this code snippets is from haha 2.0.4
image

Actually AOSP perflib had already a fix in 2015, see this: https://android.googlesource.com/platform/tools/base/+/72b27494b12ef02e0a9435a9b6451c0e61461074%5E%21/#F6

image

Upgrade compiler version to 1.7

Hi I'm getting an missing EnclosingMethod warning when I compile leak canary and I believe its caused by HAHA having an outdated compiler version. Can you upgrade the compiler version to 1.7?

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.base.Joiner$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.collect.Iterables$3) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.collect.Iterables$2) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.

Incorrect retain size and native size

After dump hprof file:
snapshot = Snapshot.createSnapshot(buffer);
snapshot.computeDomintors();
The param values shallowSize, instanceCount are correct; but totalRetainedSize, nativeSize are incorrect compare to hprof(which show in Android Studio).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.