This project has moved and is read-only. For the latest updates, please go here.

How to dispose HtmlDocument?

Topics: Developer Forum, User Forum
Oct 24, 2012 at 12:09 AM

I have a method that has a string param (html).

I use it to construct HtmlDocument and query it. My question is do I need to dispose of HtmlDocument somehow? If yes, how? it does not implement IDisposable.....



Jan 12, 2013 at 4:49 PM


I would also like to know the answer to this question. I am parsing a BIG HTML document (~1.5 Mb string send into LoadHtml), and the tree is taking up approximately 250 Mb of memory. After I've done my parsing, I would like to release the HtmlDocument from memory.

Jan 17, 2013 at 7:30 PM

Any chance one of the project members can help with this?

One of the Stack Overflow answers suggests setting the doc to null and then doing GC.Collect() - surely there has to be better way then forcing garbage collection....