Memory leaks in Parse function of XercesDOMParser
-------------------------------------------------

                 Key: XERCESC-1873
                 URL: https://issues.apache.org/jira/browse/XERCESC-1873
             Project: Xerces-C++
          Issue Type: Bug
          Components: DOM
    Affects Versions: 2.8.0
         Environment: Solaris 10.0
            Reporter: Vaibhav Agarwal


Hi,

It seems that there is a memory leak in the parse function of XercesDOMParser. 
Memory used by the server process keeps on increasing after certain number of 
requests. Is anyone aware of such memory leak existing in Xerces libraries? 
Below are the details:

OS used: Solaris 10
Xerces version: 2.8.0

Code Snippet which leaks:

RWCString xmlString; 

                int errorCount = 0;

                m_domParser = new XercesDOMParser();
RWCString schemaLocationsString;
                                bool noNameSpace;
                                
m_xmlDocData.GetSchemaLocation(schemaLocationsString, noNameSpace)
                                
m_domParser->setExternalSchemaLocation(schemaLocationsString);
                                
m_domParser->setValidationSchemaFullChecking(false);

                                XercesDOMParser::ValSchemes valScheme;
                                if (m_xmlDocData.GetXsdValidationLevel() == 
XmlProcessData::VALIDATION_OFF)
                                                valScheme = 
XercesDOMParser::Val_Never;
                                else if (m_xmlDocData.GetXsdValidationLevel() 
== XmlProcessData::VALIDATION_ON)
                                                valScheme = 
XercesDOMParser::Val_Always;
                                else 
                                                valScheme = 
XercesDOMParser::Val_Auto;

                                m_domParser->setValidationScheme(valScheme);
                                m_domParser->setDoNamespaces(true);    // 
optional
                                m_domParser->setDoSchema(true);
                                m_domParser->setErrorHandler(m_errorHandler);
                }
                RWCString theString = xmlbuffer;
                
                m_errorHandler->resetErrors();
                
                MemBufInputSource* membuf;
                
                                membuf = new MemBufInputSource(
                                                                (const 
XMLByte*)theString.data(), strlen(theString.data()), "APIXMLInterface",false);

                
                                const unsigned long startMillis = 
XMLPlatformUtils::getCurrentMillis();
                                m_domParser->parse(*membuf); //memory 
utilzation increases here and later on when delete m_domParser is called, it is 
not released.
                                const unsigned long endMillis = 
XMLPlatformUtils::getCurrentMillis();
                                unsigned long duration = endMillis - 
startMillis;
                                m_doc = m_domParser->getDocument();             
              
                                delete membuf;
                                membuf = 0;
                                delete m_domParser;
                                m_domParser = 0;

Can someone please help me out in this? Have we done something wrong here?


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to