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 / C++ / MFC
  4. MSXML2 - XML parser Memory Leak

MSXML2 - XML parser Memory Leak

Scheduled Pinned Locked Moved C / C++ / MFC
announcementhtmlxmlperformancehelp
3 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.
  • C Offline
    C Offline
    chevu
    wrote on last edited by
    #1

    Hi, We are using Microsoft provided DOM parser - MSXML2 version 4(or 40) When we are saving XML file, we are generating whole new file including all nodes and elements. Size of XML file is 3.5 MB. So it is taking 350 MB memory (both virtual as well as physical) Once save is done we are releasing all the XML objects. But there is no change happening in memory. So every consecutive save keeps on increasing memory by 350MB (approx) After 3-4 save we have to restart application again. We have seen that if we minimize the application physical memory is coming back to original size (mean additional 350MB is getting reduced) but virtual memory is not changing. I think may be OS have reserved that place for application as memory cleaning is not done properly. But we have make sure that we have release all the memory we use. Some where on some forum we seen a work around like this,

    VARIANT_BOOL bstatus;
    m_pXMLDomDoc->loadXML(CComBSTR(""), &bstatus );
    Release(m_pXMLDomDoc);

    That guy suggested that after you release saved document try to load a blank file. It will remove uncleaned area. But there is not much improvement. Please let me know if someone can help me.

    N 1 Reply Last reply
    0
    • C chevu

      Hi, We are using Microsoft provided DOM parser - MSXML2 version 4(or 40) When we are saving XML file, we are generating whole new file including all nodes and elements. Size of XML file is 3.5 MB. So it is taking 350 MB memory (both virtual as well as physical) Once save is done we are releasing all the XML objects. But there is no change happening in memory. So every consecutive save keeps on increasing memory by 350MB (approx) After 3-4 save we have to restart application again. We have seen that if we minimize the application physical memory is coming back to original size (mean additional 350MB is getting reduced) but virtual memory is not changing. I think may be OS have reserved that place for application as memory cleaning is not done properly. But we have make sure that we have release all the memory we use. Some where on some forum we seen a work around like this,

      VARIANT_BOOL bstatus;
      m_pXMLDomDoc->loadXML(CComBSTR(""), &bstatus );
      Release(m_pXMLDomDoc);

      That guy suggested that after you release saved document try to load a blank file. It will remove uncleaned area. But there is not much improvement. Please let me know if someone can help me.

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      Using which tool did you check the Memory usage? If you checking this from the task manager of window XP, I must say that you should consider only the VM usage, the memory usage it specifies is actually Working Set. I dont remeber excatly, but there was problem with DOM parser such that it will release the memory completely only when the thread( that created DOM objects are created) is terminated. You can try like, create a dedicated thread to read the data from the XML and once it is done, end that thread and check whether the memory is back to normal or not( VM size, not Memory usage ).

      nave [My Articles] [My Blog]

      C 1 Reply Last reply
      0
      • N Naveen

        Using which tool did you check the Memory usage? If you checking this from the task manager of window XP, I must say that you should consider only the VM usage, the memory usage it specifies is actually Working Set. I dont remeber excatly, but there was problem with DOM parser such that it will release the memory completely only when the thread( that created DOM objects are created) is terminated. You can try like, create a dedicated thread to read the data from the XML and once it is done, end that thread and check whether the memory is back to normal or not( VM size, not Memory usage ).

        nave [My Articles] [My Blog]

        C Offline
        C Offline
        chevu
        wrote on last edited by
        #3

        Ya I am using task manager only. I also tried to save in thread but no improvements. Same behavior.

        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