androidandroid-recyclerviewandroid-bitmap

How can I solve this bitmap memory leak on Android?


I am facing a big problem with Bitmap memory leak.

this is the dump

This memory dump shows the Bitmap never go way but stay in the heap and it causes ARN.

How can I solve this?

This is mostly used in Adapter.


Solution

  • You should call recycle() so the garbage collector can free the memory if you target android device < version 3.0 (API Level 11). Google also recommend to use Glide to manage Bitmap, to abstract complexity.

    You can find full reference here