A Drawable
is much more broad than a Bitmap
. Drawable
is intended to represent anything the graphics system can render to the display. There are subclasses of Drawable
- such as as ShapeDrawable
, or ColorDrawable
- that do not contain Bitmap
s and hence do not need any sort of manual memory management.
A BitmapDrawable
wraps a Bitmap
and contains a reference to a Bitmap
. The Bitmap
is special, because Android maintains the pixel data for all Bitmaps
in a separate heap, which is managed separately from the rest of your application. When the Android garbage collector cleans up a Bitmap
object, it also cleans up the the pixel data from the bitmap heap. But you can force it to happen sooner by manually calling recycle()
on the Bitmap
, which marks the Bitmap
invalid and releases its pixel data.
Android allocates a fixed size bitmap heap for each running application, and it is possible for your app to exhaust its heap by leaving too many Bitmap
s in use at once. That's why if your application uses bitmaps extensively, you will probably benefit from recycling bitmaps as soon as you know you won't need them.
Update: as noted in the comments, the separate bitmap heap applies to pre-Honeycomb versions of Android. As of Honeycomb, the bitmap heap was merged with the application heap. Here's a SO post with more info.