(Native) Heap Memory Statistics on Android

I’m working a tiny bit on an application called FaceIT from time to time which uses a shitload of bitmaps in the two activities it consists of. Note that i’m not responsible for the original application but just started fixing some bugs in it a couple of weeks ago. The app suffers from silly out of memory exceptions due to Bitmap data not getting freed as the Bitmap objects in the VM don’t take up enough memory so the GC collects them and frees the native heap memory associated with them (Which the GC knows nothing about). So i poked around a little and found out that there is actually a way to get the native heap memory usage of an app on Android!

Both return the respective sizes in bytes. With this it is quiet easy to monitor native heap allocations that happen with say Bitmap instances.

All hail Android! In other news: Collada is a bitch…

5 thoughts on “(Native) Heap Memory Statistics on Android

  1. wow, extremely valuable information there. Thanks for sharing. I just wanted to have a quick and dirty statistics output, but that info might help me quiet a bit more in the future.

  2. hprof is of coures amore feature complete alterantive to the statistics output i provide. I just wanted to have something quick and dirty :).

Leave a Reply

Your email address will not be published.