5

I'm using a layout with a webview ... every time I load a page in the web view I notice in the task manager that I get a memory leak... seems like my webview keeps in memory all pages' data... how can I avoid this behavior?

Aurelio De Rosa
  • 21,856
  • 8
  • 48
  • 71
Erenwoid
  • 983
  • 6
  • 13
  • 25
  • Are you setting a WebViewClient to your WebView before you load the URL? – serkanozel Sep 30 '11 at 03:09
  • Whatever "task manager" is, it is not a reliable indicator of memory leaks. If you want to determine if you have memory leaks, dump the heap from DDMS (or use the `Debug` class) and analyze the heap with MAT. – CommonsWare Sep 30 '11 at 12:13
  • @serkan yes I do, what should change? – Erenwoid Sep 30 '11 at 12:26
  • @CommonsWare yes it's true, anyway my application is getting slow.. looking for this issue, I found that is a known bug since 2009 and I don't know if has been fixed ... I'm using Cyanogen mod, maybe here still exists.. – Erenwoid Sep 30 '11 at 12:26
  • Look at [this bug report](http://code.google.com/p/android/issues/detail?id=5067). Although, as [@CommonsWare](https://stackoverflow.com/users/115145/commonsware) said, using the task manager is not a very effective way of identifying memory leaks. Also, look at [this question](https://stackoverflow.com/questions/3130654/memory-leak-in-webview). – Gallal Oct 04 '11 at 18:16

0 Answers0