I have a program that loads a bitmap from gallery (by dispatching intent for result) and then displays the image. Then when leaving the activity that displays the image, I call bm.recycle()
. But that does not seem to be recycling the bitmap? I know this because of the problem described in the post here: android bitmap out-of-memory error after getting same image twice in a row.
This question is specifically as stated in the present title: Why is onDestroy not recycling the bitmap? (I only provide the link for some context not as a distraction)
Here is my onDestroy:
@Override
protected void onDestroy() {
super.onDestroy();
unbindDrawables(findViewById(android.R.id.content).getRootView());
System.gc();
myImage.recycle();
myImage = null;
}