I've been reading about memory leaks in Android. In my application, I was getting java.lang.OutOfMemoryError: bitmap size exceeds VM budget
exception. As I googled it, I found it to be a common error (this SO question and this SO question deal with the problem) and I used a suggested solution.
I found an official Android documentation dealing with the issue and SO question explaining the official example. It says in the example:
the drawable has a reference to the TextView which itself has a reference to the activity (the Context) which in turns has references to pretty much anything
I still don't understand one thing: if Drawable isn't declared as static, why isn't it destroyed in activity's onDestroy()
method? Drawable is destroyed, TextView is destroyed, Activity is destroyed - no references and no memory leaks. Isn't it how it is supposed to work?