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 "Vaibhav Agarwal (JIRA)" <xe...@xml.apache.org> on 2009/06/12 15:30:08 UTC

[jira] Created: (XERCESC-1873) Memory leaks in Parse function of XercesDOMParser

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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Closed: (XERCESC-1873) Memory leaks in Parse function of XercesDOMParser

Posted by "David Bertoni (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Bertoni closed XERCESC-1873.
----------------------------------

    Resolution: Invalid

Please do not open Jira issues to ask questions.  Instead, post a question to the Xerces-C users list:

http://xml.apache.org/mail.html#xerces-c-user

> 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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org