How to Fix the Memory Leak in IE WebBrowser Control?

后端 未结 18 969
走了就别回头了
走了就别回头了 2020-11-27 05:33

I am trying to embed a WebBrowser Control in a C# Winform Application. This sounds easy enough. However I discovered that the WebBrowser control eats up a lot of memory ever

18条回答
  •  天命终不由人
    2020-11-27 05:53

    There's an alternative control that uses Gecko (The engine Firefox uses) instead of Trident and works very well with the MSHTML interfaces.

    Your pages will render in Gecko, and you'll have complete control over the settings, plugins, security and any other customisable features of a browser.

    The downside is that you'll need to ship Gecko with your app, I last used the equivalent of Firefox 2 and it was around 8MB.

    I released an app quite a while ago that compared IE and Firefox rendering alongside each other, both updating as you edited the CSS. I didn't run into the memory problems you've had with the web browser control, but I found the Gecko control very easy to work with. It doesn't have the same managed wrapper class that the .net WebBrowser control has, but it's easy enough to work around that.

提交回复
热议问题