In my app, i've been dillegently 'unloading' bitmaps when i need memory. I clear out as much as I can.
E.g. when a view becomes invisible (onPause) or just before you start loading a big bitmap: - do a setImageBitmap(null) (or similar methods, depending on which class of View you're actually using) on these views - clear any bitmap cache I actually implemented a global 'bitmap memory notifier' to any instance that may be interested in it. Instances can register with this notifier as a listener. If some part of my code needs to create a large bitmap, it calls this notifier which causes all listeners to get notified and they can take action to clear out as much bitmap-memory as possible (someBitmap.recycle(); someBitmap = null; clean caches; etc.) So far, this scheme has served me well. Before i got a lot of OOM- errors. Now i get a looooot less. And, if i still get one, i try to handle it gracefully. On Apr 30, 4:00 pm, Ward Willats <[email protected]> wrote: > At 11:23 AM -0700 4/30/09, fadden wrote: > > >It's possible that it didn't actually jump back down. The event log > >shows results from all running processes, not just your app, so you > >may be seeing output from other things mixed in. > > Ah, OK. Now I see a steady increase in my limit and allocs from 1.1 > up to about 10 MB when it crashes, and I've got another 3.5 in my > regular heap -- still less than 16, but ok, -- so this makes sense, > and I hope this thread is useful to others --> you can "leak" and > look fine in ddms! > > But this means that the bitmaps for my startup animations, say, are > never getting freed, as are the contents of previous screens. Now, > none of this stuff is kept in static variables or anything (he said, > though you can be sure he is going to check this yet again!).... > > Is there a way to really really make these things get tossed? There > ain't no recycle() on drawable (or animation I think)....just > bitmaps.... > > >(This is why the python script I posted yesterday shows the pid and 5- > >char app id on each line.) > > I seem to have completely missed this post... > > Thanks > > -- Ward --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

