How to Fix the Memory Leak in IE WebBrowser Control?

后端 未结 18 952
走了就别回头了
走了就别回头了 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 06:05

    I had same similar problems. I was sending more than 5000 navigation requests via web browser to scrape dynamic pages. After about 50 request, I would run out of memory as navigation request memory usage was not released after each request. I used webBrowser.Dispose() after the navigation, and it solved the problem. It does not have to do with IE7 or so. I am using IE 11 and got same problem. It was because I was not disposing the navigation Objects. Hope this helps.

提交回复
热议问题