[ http://issues.apache.org/jira/browse/XERCESC-1362?page=history ]
Alberto Massari updated XERCESC-1362:
-------------------------------------
Assign To: Alberto Massari
Summary: memory leak in reading XMLURL (was: memory in reading XMLURL)
Version: 2.6.0
Component: Utilities
(was: DOM)
> memory leak in reading XMLURL
> -----------------------------
>
> Key: XERCESC-1362
> URL: http://issues.apache.org/jira/browse/XERCESC-1362
> Project: Xerces-C++
> Type: Bug
> Components: Utilities
> Versions: 2.5.0, 2.6.0
> Environment: redhat linux AS3.0,
> bash-2.05b$ uname -a
> Linux 2.4.21-15 #1 Wed May 12 13:47:22 EDT 2004 i686 i686 i386 GNU/Linux
> Reporter: jesse
> Assignee: Alberto Massari
>
> #include <stdio.h>
> #include <string>
> #include <iostream>
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/AbstractDOMParser.hpp>
> #include <xercesc/dom/DOMImplementation.hpp>
> #include <xercesc/dom/DOMImplementationLS.hpp>
> #include <xercesc/dom/DOMImplementationRegistry.hpp>
> #include <xercesc/dom/DOMBuilder.hpp>
> #include <xercesc/dom/DOMException.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xercesc/dom/DOMNodeList.hpp>
> #include <xercesc/dom/DOMError.hpp>
> #include <xercesc/dom/DOMLocator.hpp>
> #include <xercesc/dom/DOMNamedNodeMap.hpp>
> #include <xercesc/dom/DOMAttr.hpp>
> #include <xercesc/framework/MemBufInputSource.hpp>
> #ifdef XERCES_CPP_NAMESPACE_USE
> XERCES_CPP_NAMESPACE_USE
> #endif
> int read_url(std::string const & url_str){
> int rc = 0;
> xercesc::XercesDOMParser * parser;
> xercesc::DOMDocument *m_pDoc;
> bool bRecognizeNEL;
> xercesc::AbstractDOMParser::ValSchemes valScheme;
> bool bDoNamespaces;
> bool bDoSchema;
> bool bSchemaFullChecking;
> bool bDatatypeNormalization;
> bool bCreateEntityReferenceNodes;
> bRecognizeNEL = false;
> valScheme = AbstractDOMParser::Val_Auto;
> bDoNamespaces = false;
> bDoSchema = false;
> bSchemaFullChecking = false;
> bCreateEntityReferenceNodes = false;
> bDatatypeNormalization = true;
> // Initialize the XML4C system
> try{
> XMLPlatformUtils::Initialize();
> if (bRecognizeNEL)
> XMLPlatformUtils::recognizeNEL(bRecognizeNEL);
> }
> catch (const XMLException& toCatch){}
> parser = new XercesDOMParser();
> parser->setValidationScheme(valScheme);
> parser->setDoNamespaces(bDoNamespaces);
> parser->setDoSchema(bDoSchema);
> parser->setValidationSchemaFullChecking(bSchemaFullChecking);
> parser->setCreateEntityReferenceNodes(bCreateEntityReferenceNodes);
>
> try{
> XMLURL url(url_str.c_str());
> URLInputSource src(url);
> // reset document pool
> parser->resetDocumentPool();
> parser->parse(src);
> m_pDoc = parser->getDocument();
>
> }catch(...){
> rc = -1;
> }
>
> if(parser)delete parser;
> // And call the termination method
> XMLPlatformUtils::Terminate();
> return rc;
> }
> int main(){
> while(1){
> read_url("http://127.0.0.1/abcd/op1.xml");
> sleep(2);
> }
> return 0;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]