WebView leaks entire Activities - with a simple example!
<p>I'm starting to notice, that, even on honeycomb, you'll leak an entire Activity and WebView if you're using WebView and you rotate your phone a few times.</p>

<p>I've got some test code here for proof:</p>

<pre><code>public class WebViewTestActivity extends Activity {
    /** Called when the activity is first created. */
    private WebView mWeb;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mWeb = (WebView)findViewById(R.id.web);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mWeb.destroy();
        mWeb = null; // just making sure.
    }
}
</code></pre>

<p>This seems simple enough, but if you launch the app, rotate your device a few times, and then dump an hprof to view it in MAT or something similar, you'll see two things:</p>

<p>First, there are <strong>two</strong> instances of WebViewTestActivity hanging around, and <strong>two</strong> instances of WebView.  This seems to be the case no matter how many times you rotate your device.</p>

<p>This seems like a huge problem, leaking an entire Activity, and I've googled it to no avail.  I see several complaints about this issue, but no official responses or workarounds.  </p>

<p>Can anyone shed some light on this?</p>

<p>Edit: MAT screenshots of shortest path to GC roots, excluding soft, weak, and phantom references: <a href="http://vimtips.org/media/mat.png" rel="nofollow">http://vimtips.org/media/mat.png</a></p>

<p>Edit: I was wrong, this bug is fixed in Gingerbread and up.  Wish there was a way to work around it in previous releases.</p>
