DDMS Heap - 1-byte array(byte[], boolean[])

Tobias Moe Thorstensen picture Tobias Moe Thorstensen · Nov 27, 2012 · Viewed 8.4k times · Source

I experience some memory leaks in my android application. I've already used MAT to analyze the memory usage. But I have one question from the DDMS perspectiv in Eclipse, what does 1-byte array[byte[], boolean[]) mean?

enter image description here

Is this specific for my application? You can see that this is the big memory leak issue, this always increases in size, and the rest will increase and decrease randomly. My guess is that the GC doesn't catch this type. Can anybody explain why this happen, with this little information?

Answer

Luis picture Luis · Nov 27, 2012

One byte array is the designation for any data structure that is organized as a single byte array. In you case and with that size, I would bet in a Bitmap or a Drawble.

Most common reasons for memory leaks are static object not properly managed and holding references to:

  • Context
  • View (which holds reference to context (and possibly also to bitmap)
  • Thread (which are not easly collected by GC)
  • Handler (which holds reference to context)

Most of them can be solved ensuring that you set the object to null when it's no long required.

Regards.