XmlDocument caching memory usage

Posted by mdsharpe on Stack Overflow See other posts from Stack Overflow or by mdsharpe
Published on 2010-04-06T10:48:04Z Indexed on 2010/04/06 10:53 UTC
Read the original article Hit count: 292

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about cache