My application often experienced OutOfMemory exception. To trace memory leak, I got memory dump from my application process and examined it in Eclipse Memory Analysis.
The tool gave me a report of potential memory leak. The report is listed below. The report said there are many android.webkit.WebHistoryItem instances in the process and the used a lot of memory. My application has two activities. Activity A starts Activity B, and B finishes when a button on Activity B is pressed. Only Activity B contains a WebView. And this activity only opens one HTML page each time. In the code, I cleared the web history when the Activity containing the WebView finishes: public void onDestroy() { super.onDestroy(); m_storyWebView.clearCache(false); m_storyWebView.clearHistory(); } When I got the memory dump, Activity B is closed. Now the question is, why there are still many WebHistoryItem existing in the process. And, how can I get rid of the WebHistoryItem instances completely? Thanks. ******************* Eclipse Memory Analysis report ****************************** 26 instances of "android.webkit.WebHistoryItem", loaded by "<system class loader>" occupy 1,210,328 (27.03%) bytes. Biggest instances: * android.webkit.WebHistoryItem @ 0x43cf6fd8 - 80,120 (1.79%) bytes. * android.webkit.WebHistoryItem @ 0x43fb2670 - 80,120 (1.79%) bytes. * android.webkit.WebHistoryItem @ 0x43e93e00 - 78,176 (1.75%) bytes. * android.webkit.WebHistoryItem @ 0x43f63cb8 - 78,176 (1.75%) bytes. * android.webkit.WebHistoryItem @ 0x43cf5d60 - 65,168 (1.46%) bytes. * android.webkit.WebHistoryItem @ 0x43f19a88 - 65,168 (1.46%) bytes. * android.webkit.WebHistoryItem @ 0x43d1c280 - 62,408 (1.39%) bytes. * android.webkit.WebHistoryItem @ 0x43d11720 - 58,992 (1.32%) bytes. * android.webkit.WebHistoryItem @ 0x43d51a48 - 57,912 (1.29%) bytes. * android.webkit.WebHistoryItem @ 0x43d9e6c8 - 57,672 (1.29%) bytes. * android.webkit.WebHistoryItem @ 0x43d2fcc8 - 55,728 (1.24%) bytes. * android.webkit.WebHistoryItem @ 0x43d143d0 - 51,344 (1.15%) bytes. * android.webkit.WebHistoryItem @ 0x43e202e0 - 49,568 (1.11%) bytes. * android.webkit.WebHistoryItem @ 0x43ef74d8 - 49,304 (1.10%) bytes. * android.webkit.WebHistoryItem @ 0x43f513f8 - 47,144 (1.05%) bytes. * android.webkit.WebHistoryItem @ 0x43f18808 - 46,280 (1.03%) bytes. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en