A byte
and a boolean
are each 1 byte. If you have an array of those you have a "1-byte array".
A ByteBuffer
for example should internally hold one of those.
You have a total of 614 of them where the smallest one be a byte[24]
(or boolean[24]
), the largest one is 3MB. All of them together use 104MB.
The GC will get rid of them if they are no longer referenced.
For example when you put
private static byte myArray[] = new byte[3 * 1024 * 1024];
in one of your classes and never set it back to null (myArray = null
) then this one can't be garbage collected because another Object has a reference to it. The object would be the class itself (as in String.class
). The class object can't be garbage collected since classes are never unloaded. (they are referenced by their ClassLoader
which could itself be referenced / loaded by another ClassLoader
and you can't create Objects & use classes without them - they need to stay and they need to keep a reference to their classes)
It's usually not that simple but often start with static
somewhere.
Within MAT (after you force GC) look at the reference chain for the objects that are no longer intended to stay alive and identify the one Object that holds the reference. Set that one to null
in your code and your leak is gone. Explained in more detail here:
http://android-developers.blogspot.de/2011/03/memory-analysis-for-android.html