You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "tmsandeep07@gmail.com" <tm...@gmail.com> on 2011/12/21 13:13:09 UTC

Help required regarding memory leak issue



Hi,

We are using xerces version 3.1.1.0 (DLL name xerces-c_3_0.dll) in one of our projects. Our application is using the parser very frequently to update the xml file with some data.

Our xml file will look like this:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<?xml-stylesheet type="text/xsl" href="File.xsl"?>
<Root>
        <child1>
                <elem1>hi1</elem1>
                <elem2>hi2</elem2>
                <elem3>hi3</elem3>
                <elem4>hi4</elem4>
                <elem5>hi5</elem5>
                <elem6>hi6</elem6>
        </child1>
        <child2>
                <elem1>hi1</elem1>
                <elem2>hi2</elem2>
                <elem3>hi3</elem3>
                <elem4>hi4</elem4>
                <elem5>hi5</elem5>
                <elem6>hi6</elem6>
        </child2>
</Root>
At the beginning there use to be only an <Root> node in the file which is our requirement.
The processes of the manipulations are as below

1. We will be doing getdocument always, for our manipulation.

Our code Looks like this:
Init function looks like below
Init()
{
        XMLPlatformUtils::Initialize();  // Initialize Xerces infrastructure
        xercesc::DOMDocument* m_XmlFileParser = new XercesDOMParser();
        struct stat fileStatus;
        int iRetStat = stat(m_strDiagnosticsFile, &fileStatus);
        m_XmlFileParser->setValidationScheme( XercesDOMParser::Val_Never );
        m_XmlFileParser->setDoNamespaces( FALSE );
        m_XmlFileParser->setDoSchema( FALSE );
        m_XmlFileParser->setLoadExternalDTD( FALSE );
        m_XmlFileParser->parse( m_strDiagnosticsFile );
        pDOMDocument = m_XmlFileParser->getDocument();
}
Deinit function looks like
Deinit()
{
        m_XmlFileParser->reset();
        m_XmlFil
Email truncated to 2,000 characters


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