Memory fragmentation does not cause this; the Dalvik heap limit is enforced based on the actual active allocations.
Note that bitmaps are NOT include in the Dalvik heap based on what ddms reports, but they are included in the heap limit, so most likely you have a lot of bitmap data. (In HC this is changed and bitmap data is now allocated directly on the Dalvik heap.) On Thu, Feb 24, 2011 at 12:42 PM, Sheado <[email protected]> wrote: > Hello. I tried posting this earlier, but it didn't seem to stick (so > sorry if it double posts). > > My app occasionally runs out of memory when loading bitmaps. I call > recycle() on every bitmap I'm done with and even set them to null. > > As far as diagnostics: > * I ran ddms and never saw the heap go over 5.5mb. The largest image I > load is 480x320, so there's no way that pushing it over the 16mb > limit. > * I dumped the event log and noticed this at one point: > I/dvm_gc_info( 6655): > [7290888427799873005,-9036888781628737488,-3939943202692585437,9505022] > According to somebody else's post this could be bad (sorry I lost the > link to that post). (gdb) print (0xtop12 & 0x1ff) << ((0xbottom12 >> > 9) * 4) ==> resulting in greater than 17mb > * to confirm this, I dump hprof and analyzed it with Eclipse Mat, but > all I saw was a peak usage of 2.1mb and a suspected leak of 700k > * Scouring the forums, I found this: > > http://groups.google.com/group/android-developers/browse_thread/thread/45720ebd657b49fa/9a8b87f65990e8a2?lnk=gst&q=out+of+memory+16mb#9a8b87f65990e8a2 > Could my problem really be due to memory fragmentation? My app does > load and unload(recycle) bitmaps often. > > I don't know which of these to believe and what to do to prevent these > out of memory exceptions from ever happening again - or at the very > least I'd like to properly interpret the data I'm getting from these > logs and profilers. > > any advice would be awesome! > thanks. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

