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!
1 2 |
android.os.Debug.getNativeHeapSize(); android.os.Debug.getNativeHeapFreeSize(); |
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…