Unload DOM
-
Hi I need to free the memory occupied by xml document. I tried to use this code inside button XmlDocument xmldoc = new XmlDocument(); xmldoc.Load("c:/a.xml"); you can check for memory performance in windows task manager I have already made one project The problem is coming in this xml loading every time its creatting own instance and incraeasing the memory. If any one has any idea to free momory if some one give me example of relasing momory thanks
-
Hi I need to free the memory occupied by xml document. I tried to use this code inside button XmlDocument xmldoc = new XmlDocument(); xmldoc.Load("c:/a.xml"); you can check for memory performance in windows task manager I have already made one project The problem is coming in this xml loading every time its creatting own instance and incraeasing the memory. If any one has any idea to free momory if some one give me example of relasing momory thanks
Could you explain the setup a little more? The .NET Framework's garbage collection usually handles these things quite nicely. Unless you are loading many XML documents and keeping references to them (so the garbage collector thinks you still need them), you shouldn't have any problems. As a side note, if you are processing many XML documents, and using them in a read-only fashion. You can gain performance by using either XmlReader or XPathDocument. (I prefer XPathDocument.) John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek. -
Could you explain the setup a little more? The .NET Framework's garbage collection usually handles these things quite nicely. Unless you are loading many XML documents and keeping references to them (so the garbage collector thinks you still need them), you shouldn't have any problems. As a side note, if you are processing many XML documents, and using them in a read-only fashion. You can gain performance by using either XmlReader or XPathDocument. (I prefer XPathDocument.) John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.Hi John, In my project every time XML file is loaded and read thr Xml reader but when the form is closed it should be freed by memory but it does not happen its due to XmlDocument I just for example tried to do inside the button i want that after pressing the button it should load and free the memory occupied by processor. Do you have any idea you can tell me in class to load the XMlDocument and Unload XmlDocument Thanks sanjeev
-
Hi John, In my project every time XML file is loaded and read thr Xml reader but when the form is closed it should be freed by memory but it does not happen its due to XmlDocument I just for example tried to do inside the button i want that after pressing the button it should load and free the memory occupied by processor. Do you have any idea you can tell me in class to load the XMlDocument and Unload XmlDocument Thanks sanjeev
It sounds like you are watching some sort of Windows memory tool (like TaskManager). This is not an accurate way to analyze memory usage in the .NET Framework. (It does not instantly free memory when you quit using a variable.) Read a few articles like this[^], and you'll have a better understanding of the real behavior of garbage collection in the .NET Framework. John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.