0

I read that before 3.0 data like bitmaps is strored outside the heap. But where exactly is it stored? And how can I analize the amount of memory consumed by my bitmaps? That all about OOM exeption.

1 Answers1

1

The are located in the native heap. For more info Bitmaps in Android. You can get runtime information about the native heap using these methods.

getNativeHeapAllocatedSize

getNativeHeapFreeSize

getNativeHeapSize

Community
  • 1
  • 1
Mojo Risin
  • 8,136
  • 5
  • 45
  • 58
  • I can see that native heap constantly grows, until exceeds it limit. Am I right? –  Mar 28 '11 at 20:39
  • If you are only decoding Bitmap without freeing them - yes – Mojo Risin Mar 28 '11 at 20:53
  • Yes, I've got HashMap and I don't remove bitmaps from it. Thanx for response. –  Mar 28 '11 at 20:57
  • 1
    It's good practice to call http://developer.android.com/reference/android/graphics/Bitmap.html#recycle() when you don't need the bitmaps any more. – Mojo Risin Mar 28 '11 at 21:20
  • recycle is called on the destructor any way. Better just null them and wait for the GC do its job. – Danail May 12 '11 at 08:44