On Apr 28, 1:33 pm, Ward Willats <goo...@wardco.com> wrote: > So am I really out of memory or just chasing my tail?
You're really out of memory. Bitmap storage exists in a weird parallel universe. The memory isn't allocated in the virtual heap, but we act like it is when it comes to deciding if you're out of memory. The per-VM cap is 16MB. (Aside: suppose you have 2MB of stuff, and the "soft limit" is 3MB. You allocate a bunch of objects until you hit the 3MB mark, then a GC happens. If you free "enough", the soft limit stays where it is. If you don't free "enough", the soft limit is advanced. This way we're not allocating physical memory pages that we don't need, but neither are we GCing constantly. Choosing the right value for "enough" is something of an art.) If you have, say, 4MB of bitmaps, and you start allocating lots of objects, you will OOM when you hit 12MB of objects. Where things get a little quirky is that the opposite isn't true: if you run out of memory while allocating a bitmap, we don't GC. Freeing objects won't help unless the soft limit moves. (I think we can shrink it now, but I suspect we can only do that if there are no objects sitting out at the end -- remember, the Dalvik GC doesn't do compaction at this time, which is the main reason why we have this somewhat bizarre tiered system.) If the bitmaps were proper objects on the virtual heap, this would be less weird, but there's a fair chance you'd still be running out of memory at this point. --~--~---------~--~----~------------~-------~--~----~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---