Home > Tutorials > Bitmap and memory leak!

Bitmap and memory leak!


Whenever using a Bitmap object, it consumes the heap memory! So if your code simply just declares and use it without release its memory, you would face memory leak problem.

It’s men

Remember to always free Bitmap objects memory before finishing your application or whatever objects containers.


Bitmap image = ..... (whatever)

...

if(image != null) {

image.recycle();

image = null;

}

It’s mentioned here on Android Documentation References: Bitmap.recycle()

 

Cheers,

Pete Houston

Categories: Tutorials Tags: , , , ,
  1. April 1, 2012 at 1:40 pm

    ok. thanks

  1. No trackbacks yet.

Leave a comment