I am building a VC++ application, in which i am using MSXML 6 parser. The
problem i am facing the memory consumption by the application. I had profiled
the application using AQTime and the profiler shows the increase the memory
consumption by the MSXML6.dll. Once the xml related task is over the memory
occupied by the application should get release but that does not happen and
the major part of memory is occupied by the MSXML6.dll .
The basic outline of the application:
1. Starts the application ( average memory consumption at this stage is ~20MB)
2. Starts a new thread ( for handling the XML function)
3. Initializes the IXMLDOMDocument.
4. Performs the xml related operations ( loading, reading- writing , saving
the xml file )
( When the application is in stage 4 ( mentioned above ) the memory
consumtion continuously increases.)
5. Once the required xml task is over , releases the xmldomdocument
objectthe thread exits but still the memory consumtion is same.
6. The memory is released only after the application is closed.
I searched a lot on the net about this problem but couldnt get the correct
solution.
Can anyone suggest what to do?
Thanks in advance.
-regards,
Tanish S.
Having got passed step 1 have you tried having your app repeat steps 2 to 5
several times before closing the app. Does it "leak memory" by the same
significant amount on each pass or after the first or second pass does the
allocated amount of memory stabilise?
MSXML manages its own heap of memory for collecting nodes, this memory is
shared by all documents. It has a form of GC to manage this heap. It also
permentantly maintains a name table so if you have wide variety of
namespaces and element names that can get quite big.
--
Anthony Jones - MVP ASP/ASP.NET
thanks for the response.
Yes, the memory leak in consitent in each pass ( from step 2 to step 5). I
had read an article on the GC of MSXML , but it didnt help much.
Can you suggest anything else so that the memory leak problem solved.
-tanish
I was rather expecting you to discover that the memory usage doesn't grow
much after second pass. It sounds like you do have a genuine memory leak.
Can you post some of your code? You're sure you are releasing all your
references ok?
My problem is that MSXML is not only allocating large objects in heap
memory, MSXML is allocating large heaps and not destroying them. Is that
what you were seeing in your app as well?
-- Darren --
I have a simple XML DOM class -
CComPtr< IXMLDOMDocument > m_pDOMDoc; // variable defined in header file
m_pDOMDoc.CoCreateInstance( __uuidof( DOMDocument), NULL,
CLSCTX_INPROC_SERVER); // called in the constructor
..
m_pDOMDoc->load // used in one of the methods
I do not see memory being released after the destructor is called. What
should I do to make sure that memory gets released?