DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5311>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5311 Memory leak parsing XML file Summary: Memory leak parsing XML file Product: Xerces-C++ Version: 1.5 Platform: PC OS/Version: Other Status: NEW Severity: Critical Priority: Other Component: Validating Parser (DTD) AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I got severe memory leaks when i parse XML Files with DOMParser class and using DTD validation. Here the simple main() routine of the test application: void main() { try { // Initialize DCM Environment (includes XMLPlatformUtils::Initialize()) cout << endl << "Initializing DCM environment..." << endl; DCMEnvironment::InitEnv(); cout << "successful" << endl; } catch(MissingEnvVariableException& e) { cout << endl << "Failure during initializing DCM environment!" << endl; cout << "Reason: " << e.getDescription() << endl; return; } catch(ParserInitializationException& e) { cout << endl << "Failure during initializing DCM environment!" << endl; cout << "Reason: " << e.getDescription() << endl; return; } catch(ModulesInitializationException& e) { cout << endl << "Failure during initializing DCM environment!" << endl; cout << "Reason: " << e.getDescription() << endl; return; } catch(...) { cout << endl << "Failure during initializing DCM environment!" << endl; cout << "Reason: unknown" << endl; return; } // run the test testLoad_ImgSequence(); // Clean up DCM Environment (includes XMLPlatformUtils::Terminate()) Diamant::DCM_L::DCMEnvironment::ExitEnv(); int result=0; result = _CrtDumpMemoryLeaks(); } Here the parsing method: void testLoad_ImgSequence() { ImageSequence* imgSeq=NULL; int count=0; while(count<100) { try { imgSeq = new ImageSequence ("d:\\Repository\\Is\\", "flicker.xml"); } catch (InvalidParameterException& e) { imgSeq=NULL; } catch (DatafilebaseNotUniqueException& e) { imgSeq=NULL; } catch (ParserErrorException& e) { imgSeq=NULL; } catch (XMLFileIOException& e) { imgSeq=NULL; } catch (...) { imgSeq=NULL; } // clean up if (imgSeq!=NULL) delete imgSeq; cout << "ImageSequence loaded." << endl; count++; } } With each creation of a ImageSequence instance the given XML file is parsed and some attributes in DOM are read: ImageSequence::ImageSequence(...) { //... // now load the image sequence data from xml DOM_Element imageSeq = _XmlDocument.getDocumentElement(); // did we have a image sequence? if(imageSeq!=NULL) { DOM_NamedNodeMap ISAttributes = imageSeq.getAttributes(); DOM_Node attribute; DOMString attrName; DOMString attrValue; char* attrNameVal; char* attrValueVal; for(int32_t count=0;count<ISAttributes.getLength();count++) { attribute = ISAttributes.item(count); attrName = attribute.getNodeName(); attrValue = attribute.getNodeValue(); attrNameVal = attrName.transcode(); attrValueVal = attrValue.transcode(); // initialize the attributes of the image sequence if (!strcmp(attrNameVal,"FPS")) _Fps = atoi(attrValueVal); //... delete attrNameVal; delete attrValueVal; } } The instrumentalized the Xerces Debug Lib with the Boundschecker and got a lot of memory leaks, e.g.: QName::QName(QName* const qname) constructor: line: fLocalPart = new XMLCh[fLocalPartBufSz + 1]; unsigned int ElemStack::addChild(QName* const child, const bool toParent) method: curRow->fChildren[curRow->fChildCount++] = new QName(child); etc. I hope you can give some comments immediately. Thanks in advance. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]