Thursday, September 2, 2010

[android-developers] Re: Bitmaps and OutOfMemoryError: Best Practices needed

We are also having occasional problems with OutOfMemory errors in
createBitmap. It tends to happen after a few orientation changes when
we are allocating the backbuffers. I have made it so that it calls
recycle() on the old bitmaps (if any exist) and does a System.gc()
before allocating the new backbuffers. Hopefully this will solve the
problem, but I'm worried that it could still happen.

What we are doing is allocating a backbuffer that is twice the width
and height of the screen so that we can quickly zoom in and out. With
a 854x480 screen this would presumably be 6.25MB in size.

The problem as I see it is the 16 or 24MB maximum heap size per
process. This is unreasonably small, especially on devices that have
512MB of RAM. Ideally the max heap size should be something like 64MB,
or perhaps allow apps to request a larger heap size from the user.

--
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