Shared publicly  - 
I've been caught saying that Bitmap.recycle() is a good idea. Here's a convoluted metaphor to explain why...

Beneath my kitchen sink I have a recycle bin and a garbage bin. The recycle bin is not managed: nobody comes by when it fills up. But the garbage bin is managed, and when it fills up a garbage man comes by and empties both bins. It's possible to overflow the recycle bin by creating lots of recyclables without creating a similar amount of garbage!

The garbage bin represents the managed heap; the recycle bin is the native heap. The garbage man is the GC and finalizer. And Bitmap.recycle() skips the recycle bin, freeing the bitmap's resources immediately. By using recycle() you avoid exhausting the native heap when your managed heap is idle.
Ray Ryan originally shared:
Discussing the pros and cons of explicitly calling recycle() on bitmaps. Too lazy to measure, but doing it anyway because +Jesse Wilson recommends it. Thus is a hashtag born: #JesseWilsonSaysItsFaster
Spencer Riddering's profile photo
Add a comment...