My program runs just fine and then I always encounter a random crash error (eg. Error inflating class ) which is almost always started by a OutOfMemoryError.
I watched my VM Heap in DDMS and it looks like gc is doing it's job as I'll watch the %used go up and down along with the #Objects
I've noticed that I get the crash when I have close to these stats:
Heap Size 11.820 MB
Allocated 7.020 MB
Free 4.801 MB
% Used 59.39%
# Objects 148,927
This is about the peak of usage on the device. Sometimes it crashes here, but other times it allows me to move around to another category which allows GC to do it's work getting the %used down to 32%. However, I usually crash shortly after even though usage is down.
I typically crash out with a chain of errors. The top-most Caused by: error is usually something like Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
I'm not sure where to go next as the device seems fine on resources when it crashes, but complains about not having enough memory. I've tried running the program without images and I still get an app that crashes. Regardless, where should I start looking to find the culprit?
** EDIT **
Kindle Fire on Android 2.3.4 via Eclipse