On Jan 9, 4:47 pm, Mark K <mark.ka...@gmail.com> wrote: > I've tried it with no de-bugger, on the emulator, and on actual G1 > hardware, I can't seem to get rid of the problem entirely. I only > process and use one bitmap at a time, bitmaps are recycled after use, > and I invoke gc(). The Runtime free memory indicates that I always > have over 10 MB free, each bitmap is less than 3.5 MB, yet this > problem still ocurs intermittently.
What does logcat show at the point of the failure? Should see some additional traffic, e.g.: 01-09 16:13:02.739 D/dalvikvm( 178): GC freed 494 objects / 31264 bytes in 265ms 01-09 16:13:02.829 I/dalvikvm-heap( 178): Grow heap (frag case) to 4.558MB for 998301-byte allocation 01-09 16:13:03.039 D/dalvikvm( 178): GC freed 133 objects / 6192 bytes in 196ms Bitmap allocations are done outside of the virtual heap, but are counted against it. This was done somewhat late in the game and not all of the tools will include the bitmap heap allocation numbers in with the actual virtual heap allocations. If you're getting an OOM you should see it bumping up against the 16MB limit in the logs. FWIW, the only thing worse than explicit calls to System.gc() is following those with explicit calls to System.runFinalization(), which in Dalvik will block until finalizers have completed. If your allocations are somehow outpacing the ability of the system to GC then finalize then GC again to free the finalized objects, you can stick a runFinalization() in between a pair of calls to gc(). However, if you're explicitly calling recycle(), this shouldn't do much since the bitmap storage should have been released. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---