OutOfMemoryError using BitmapDrawables
<p>I download and keep a list of photos in my application:</p>

<pre><code>List&lt;BitmapDrawable&gt; photos = new ArrayList&lt;BitmapDrawable&gt;();
photos.add(Utils.bitmapToBitmapDrawable(downloadBitmap(s));

public static Bitmap downloadBitmap(String url) {
    // GET input stream from server
    return BitmapFactory.decodeStream(inputStream);
}
</code></pre>

<p>Trying to deallocate: </p>

<pre><code>if (dldedPics.get(0).getPhotos() != null &amp;&amp; !dldedPics.get(0).getPhotos().isEmpty()) {
    for (BitmapDrawable b : dldedPics.get(0).getPhotos()) {
        b.getBitmap().recycle();
    }
}
dldedPics.get(0).setPhotos(null);
Runtime.getRuntime().gc();
</code></pre>

<p>I can't seem to properly have them deallocated, as I get a OutOfMemoryError (at the decodeStream line) rather quickly, after 10-20 100kb photos.</p>

<p>Stacktrace: </p>

<pre><code>11-23 09:43:07.861: E/AndroidRuntime(3079): FATAL EXCEPTION: AsyncTask #1
11-23 09:43:07.861: E/AndroidRuntime(3079): java.lang.RuntimeException: An error occured while executing doInBackground()
11-23 09:43:07.861: E/AndroidRuntime(3079):     at android.os.AsyncTask$3.done(AsyncTask.java:200)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at java.lang.Thread.run(Thread.java:1096)
11-23 09:43:07.861: E/AndroidRuntime(3079): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
11-23 09:43:07.861: E/AndroidRuntime(3079):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:459)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:515)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at com.domain.persistence.Utils.downloadBitmap(Utils.java:385)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at com.domain.service.tasks.AllPhotosDownloaderTask.doInBackground(AllPhotosDownloaderTask.java:51)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at com.domain.service.tasks.AllPhotosDownloaderTask.doInBackground(AllPhotosDownloaderTask.java:1)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
11-23 09:43:07.861: E/AndroidRuntime(3079):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
11-23 09:43:07.861: E/AndroidRuntime(3079):     ... 4 more
11-23 09:43:08.201: E/dalvikvm-heap(3079): 240000-byte external allocation too large for this process.
11-23 09:43:08.231: E/GraphicsJNI(3079): VM won't let us allocate 240000 bytes
</code></pre>
