Ok, so I should replace my calls to ImageView.getDrawable().getBitmap
().recycle() with ImageView.setImageBitmap(null) and let the GC do his
job ?
Or is the call to ImageView.setCallback(null) enough to get rid of
both ImageView and Bitmap instances ?

I'll try to track all my calls to Bitmap.recycle() and better check
where the references to these bitmaps are located.



On 18 août, 00:51, Romain Guy <[email protected]> wrote:
> Bitmap are eventually garbage collected. From the javadoc of the
> Bitmap class itself:
>
> "This is an advanced call, and normally need
> not be called, since the normal GC process will free up this memory when
> there are no more references to this bitmap."
>
>
>
>
>
> On Mon, Aug 17, 2009 at 3:14 PM, Nivek<[email protected]> wrote:
>
> > I'm sorry, I've certainly misunderstood something then, but... while
> > coding an app dealing with bitmaps, this is what it looks like.
> > Reading posts and blogs about memory management and use of bitmap led
> > me to that conclusion, and carefully recycling bitmaps in my app
> > allowed me to get rid of a lot of memory allocation exceptions.
>
> > Anyway, about memory leaks on orientation changes, another blog post
> > from Romain Guy could be useful:
> >http://www.curious-creature.org/2008/12/18/avoid-memory-leaks-on-andr...
>
> > You might try this Drawable.setCallback(null) trick...
>
> > On 17 août, 22:02, Marco Nelissen <[email protected]> wrote:
> >> On Mon, Aug 17, 2009 at 7:53 AM, Nivek<[email protected]> wrote:
>
> >> > When you change the device orientation, you app is closed and then
> >> > reopened.
>
> >> > Android handles bitmaps a "special" way, you HAVE to explicitly
> >> > recycle them as soon as you don't need them anymore... or they stay
> >> > allocated in memory and NEVER get freed.
>
> >> That is not true.
>
> --
> Romain Guy
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  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
-~----------~----~----~----~------~----~------~--~---

Reply via email to