XDocument holding onto Memory?
Posted
by Jon
on Stack Overflow
See other posts from Stack Overflow
or by Jon
Published on 2010-03-16T10:04:25Z
Indexed on
2010/03/16
10:06 UTC
Read the original article
Hit count: 344
I have an appplication that does a XDocument.Load
from a 20mb file and then gets passed to a form to view its contents:
openFileDialog1.FileName = "";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
AuditFile = XDocument.Load(openFileDialog1.FileName);
fmAuditLogViewer AuditViewer = new fmAuditLogViewer();
AuditViewer.ReportDocument = AuditFile;
AuditViewer.Init();
AuditViewer.ShowDialog();
AuditViewer.Dispose();
AuditFile.RemoveNodes();
AuditFile = null;
}
In Task Manager I can see the memory being used by my application shoot up when I open this file.
When I have finished viewing this file in my application I call :
myXDocument.RemoveNodes();
myXDocument = null;
However the memory use in Task Manager is still pretty high against my app.
Is the XDocument still being held in memory and can I decrease the memory usage by my app?
© Stack Overflow or respective owner