Sunday, May 1, 2011

About Bitmap.recycle()

It make me confused: Is it needed to call Bitmap.recycle() after used?

According to Android Reference Document of Bitmap.recycle():
Free the native object associated with this bitmap, and clear the reference to the pixel data. This will not free the pixel data synchronously; it simply allows it to be garbage collected if there are no other references. The bitmap is marked as "dead", meaning it will throw an exception if getPixels() or setPixels() is called, and will draw nothing. This operation cannot be reversed, so it should only be called if you are sure there are no further uses for the bitmap. 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.

But, many books I read suggest to free memory by calling Bitmap.recycle() once make sure no longer need it.

Please leave me comments if you have any advise.


Thank you for reading this article About Bitmap.recycle() With URL http://x-tutorials.blogspot.com/2011/05/about-bitmaprecycle.html. Also a time to read the other articles.


Write your comment for this article About Bitmap.recycle() above!