2

I read a lot about memory leaks in the last few days, and came across some interesting stuff. I saw this answer to a basic Android bitmap-related memory leak question (the answer is from 2011) and I was wondering if this is still the case. If I'm using views that contain bitmaps in my activity (ImageViews, TextViews...), do I really need to unbind their drawables when destroying the activity? Is this only in some cases or always?

Community
  • 1
  • 1
Aviv Ben Shabat
  • 1,073
  • 2
  • 13
  • 33

1 Answers1

2

It's no longer necessary as of 4.0, as the callback is now stored in a WeakReference.

From 2.3.7:

public final void setCallback(Callback cb) {
    mCallback = cb;
}

and in 4.0.1:

public final void setCallback(Callback cb) {
    mCallback = new WeakReference<Callback>(cb);
}
Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274