Tuesday, September 20, 2011

[android-developers] Random rare OOM errors

I have an app that very rarely throws this error or one like it.

java.lang.OutOfMemoryError: array size too large(Heap Size=3395KB,
Allocated=3065KB, Bitmap Size=0KB) <-- look at that small heap
or
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
(from the stacktrace on this, it seemed to be on initial view layout.
Again, very rare)

I do have some icons allocated(none are leaked), and when I run the
app, the heap shown by DDMS never seems to grow very big(2-3 megs
total). I even did a dumpsys meminfo and checked the native memory
allocations. Nothing large or alarming. I've also never experienced
the OOM myself in any sort of testing on various phones and the
emulator. I saw the Google+ app crash once the same way on app launch
on my Nexus S(I peeked at it's stack traces), so at least I'm in good
company.

It seems like there wasn't enough RAM at the time for the app
allocation, and the foreground app died w/ an OOM instead of a
background app being shutdown to free RAM. Has anyone else seen this?

Robert

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment