title: ListView memory leak: not able to recycle list elements (ImageView + Bitmap)
body: <p>I have a ListView that uses an adapter to populate a list of ImageViews.  I'm following the standard practice of: </p>
  
  <p>a) inflating a new view only if convertView is null, and</p>
  
  <p>b) using a viewHolder to avoid calling findViewById() if convertView is not null</p>
  
  <p>I'm also using an AsyncTask to populate the ImageViews from a database (or from disk cache or LRU memory cache, if possible).</p>
  
  <p>Everything works fine for awhile (i.e., images populate in the list with smooth scrolling), but I have a leak that gives an OOM error after about 70 x 1.4M images have been loaded. </p>
  
  <p>My understanding is that ListViews are recycled when getView() returns a non-null convertView, so I shouldn't see a memory build up like this.  In my case, the app's memory use grows every time an ImageView gets assigned a Bitmap.  And in fact, the Activity holds onto this memory even after I've cleared the underlying list via list.clear(), and zeroed out the adapter via adapter.notifyDataSetInvalidated() - both in the onStop() function.</p>
  
  <p>The MAT tool shows stranded Bitmaps and stranded ImageViews (approximately 1-to-1 with the images loaded), but I don't know what's holding a reference that would prevent garbage collection of the old views.</p>
  
  <p>I'd appreciate any suggestions for how to track down this leak.  Thanks!</p>