XmlDocument caching memory usage
- by mdsharpe
We are seeing very high memory usage in .NET web applications which use XmlDocument.
A small (~5MB) XML document is loaded into an XmlDocument object and stored in HttpContext.Cache for easy querying and XSLT transformation on each page load. The XML is modified on disk periodically so a cache has a dependency on the file.
Such an application appears to be using hundreds of megabytes of RAM.
I have experimented with requesting garbage collection on each request start, and this keeps the RAM usage far lower but I cannot imagine this is good practise.
Does anyone have any suggestions as to how we can achieve the same goal but with lower RAM usage?