Objects are still in memory after activity is destroyed
<p>My activity keeps a certain number of references to preview images from the camera in a Map object. This takes a lot of memory. I'm monitoring the memory usage using:</p>

<pre><code>    Runtime runtime = Runtime.getRuntime();
    long allocated = runtime.totalMemory();
    long free = runtime.freeMemory();
    long used = allocated  - free;
</code></pre>

<p>When I kill my app (back key), the activity is destroyed. When I start my app again, I can see that the memory was not cleared. The "used" figure starts at the same value and then goes up as new frames arrive.</p>

<p>When I look at the "dominator_tree" after I "Dump HPROF", I can see two instances of my activity, both taking a lot of memory.</p>

<p>When I override onDestroy() and I clear() the preview frames map object, this doesn't seem to happen.</p>

<p>I'm probably missing something here but I thought all memory should be deallocated after my activity is destroyed (after the garbage collection process), why do I have to manually clear() the map? Other objects I create don't seem to require this.</p>

<p>I tried setting android:launchMode="singleInstance" but this doesn't seem to have any affect.</p>

<p>Thanks!</p>
