Search code examples
androideclipseheap-dump

How does one analyze a heap dump on Android?


I'm getting a lot of "dalvikvm: GC_CONCURRENT..." messages in logcat, and googling around resulted in me downloading the Eclipse Memory Analyzer... I've figured out how to use it, but I don't know how to understand it. I've never dealt with memory leaks before, so bear with me.

The "Leak Suspects" include "android.content.res.Resources", "android.graphics.Bitmap", and "org.apache.harmony.xnet.provider.jsse.TrustManagerImpl" loaded by "system class loader". I don't really know what that means or how that's supposed to help me; I don't even use bitmaps in the app I'm trying to make.

How is this supposed to help me?


Solution

  • The "Leak Suspects" include "android.content.res.Resources", "android.graphics.Bitmap", and "org.apache.harmony.xnet.provider.jsse.TrustManagerImpl" loaded by "system class loader".

    Those are there for every Android application and represent memory allocated by the Android base classes.

    How is this supposed to help me?

    You can start by finding references to your own objects from your own classes, then tracing their roots to find out what is keeping those objects in memory.

    You may wish to watch this presentation from Google I|O 2011, which covers this process.