0

I implemented a custom widget that has a SparseArray which have a array of
bitmaps, when I scroll other UI widget frequently(scroll ListView quickly) make memory allocation frequently and become large, at this time I counter a problem that I can reference Bitmap from SpareArray and Bitmap is not null, but the Bitmap's status become recycled and I never do bitmap.recycle() operation! So the problem is will android system recycled bitmap automatically when memory is not enough even you have reference to it?

Jon
  • 9,156
  • 9
  • 56
  • 73
Jishi Chen
  • 634
  • 7
  • 17
  • found the reason: fresco did – Jishi Chen Jul 10 '18 at 08:16
  • You are saying that the fresco library was calling `bitmap.recycle()` and that caused your problem? – Jon Jul 10 '18 at 18:09
  • @Jon yes. I didn't copy bitmap from fresco, fresco will auto recycle bitmap even you have a reference to it.so the safe way is to copy it when get bitmap through fresco. – Jishi Chen Jul 11 '18 at 08:16
  • Then I recommend you write that as a separate *answer*. See https://stackoverflow.com/help/self-answer – Jon Jul 11 '18 at 13:10

0 Answers0