Webbrowser Control Memory Leak? RRS feed

  • Question

  • I am using a webbrowser control to display some HTML in my windows mobile C# application.  The html may contain some images that are downloaded and displayed automatically by the browser control.  However, I notice my application seems to increase its memory usage after opening new html.  It especially grabs a lot of memory when there are a lot of images involved.  I narrowed it down to the webbrowser control, by not calling the control, but an external browser (opera) instead and the leak doesn't happen.

    I have tried, disposing the webbrowser control, setting documenttext to null, setting the webbrowser object to null (and creating a new control), but none of this has resolved my issue.  Is there a solution for this?
    Thursday, July 2, 2009 6:50 PM


  • Unfortunately, I ran into the same issue long time ago. I used ActiveX component which was working ok on desktop but I detected mem leaks in WB and thought it was it but after some tests I came to a concution that it was WB control.

    The only option is to use InitHtlmView method from HtmlView.dll library and use native PIE to put it into DISPLAYCLASS window.
    It can be done along with many things (like browser cleaning, navigating, context menu disposing, clear type enabling etc.) but it requires the knowledge of implementing WndProc for created DISPLAYCLASS window and a lot of work to create a good browser control.
    If You'll find my answer satisfactory or helpful - mark it as answered! Thank You. PS. Votes also doesn't hurt :).
    • Proposed as answer by Mal Loth Thursday, July 2, 2009 9:01 PM
    • Marked as answer by emuneee Monday, July 6, 2009 6:45 PM
    Thursday, July 2, 2009 9:01 PM