Hi

I am using xerces 2.7 version in parsing xml file in C++
I tried the following code to parse an xml buffer in memory.
But this code leaks memory in line 3 when I create DOMBuilder

    // instantiate the DOM parser.
    static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
    DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(gLS);
    DOMBuilder* parser =
((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,
0);

    MemBufInputSource mis (
                        reinterpret_cast<const
XMLByte*>(m_xmlBuffer.c_str()),
                        m_xmlBuffer.length(),
                        "standard_xml",
                        false );
    Wrapper4InputSource Is (&mis, false);
    DOMDocument* m_doc = parser->parse( Is );
    m_doc->release();
     

The Rational Purify tool to detect memory leak shows
[I] MPK: Potential memory leak of 4728 bytes from 232 blocks allocated in
xercesc_2_8::MemoryManagerImpl::allocate(UINT) [XERCES-C_2_8D.DLL]
    xercesc_2_8::MemoryManagerImpl::allocate(UINT)
[F:\WORKDIR\WORDPARSER\DEBUG\XERCES-C_2_8D.DLL]


Also I cannot release the parser as it crashes. Is there any way to delete
the parser OR
Is there any way to avoid the memory leak, what needs to be done as this is
causing a big leak if I use large number of xml files.
Please suggest what needs to be done to prevent the memory leak .

PL
-- 
View this message in context: 
http://old.nabble.com/xerces-DOM-Parser-leaks-memory-%28xerces-2.7%29-tp26282418p26282418.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to