Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Unload DOM

Unload DOM

Scheduled Pinned Locked Moved C#
performancehtmlxmlhelptutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    ksanju1000
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • K ksanju1000

      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

      J Offline
      J Offline
      John Fisher
      wrote on last edited by
      #2

      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.

      K 1 Reply Last reply
      0
      • J John Fisher

        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.

        K Offline
        K Offline
        ksanju1000
        wrote on last edited by
        #3

        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

        J 1 Reply Last reply
        0
        • K ksanju1000

          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

          J Offline
          J Offline
          John Fisher
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups