Problems with memory while using HtmlAgilityPack?

.net html-agility-pack memory-leaks

Question

I notice a memory problem when i leave my app running for a long time. I actually get a out of memory exception. I try to figured out what the problem was and i was clueless until i let it run again and i notice

I get the leak on this line everytime html.LoadHtml(a_few_k_of_html);. I suspect HtmlAgilityPack is leaking. I tried wrapping it in using and calling dispose but that doesnt exist. Not only does it happen on that line everytime but i remember changing a few areas to use HtmlAgilityPack instead of parsing html with regex

How do i deal with this memory issue short of modifying HtmlAgilityPack itself?

1
6
5/23/2017 10:32:40 AM

Popular Answer

I had same problem. After processing the document i set the instance of document to null and then GC.Collect(). Problem was solved.

3
5/17/2012 2:26:40 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow