Terminate is not supposed to delete all the memory allocated by Xerces; it will just deallocate the static objects needed by Xerces. For this reason, you shouldn't call it when you still have a SAXParser object alive, or when its destructor will be called, you will crash your application.
So, enclose the code between the call to Initialize and the Terminate method call in a separate block (using { and }) to force SAXParser to be delete before Terminate. At this point you should see no more crashes nor memory leaks.
Hope this helps, Alberto
At 15.14 20/10/2003 +0200, Victor Domingo Reguant wrote:
I'm using a SAX parser in visual C++ in order to read an xml file, but when my application crashes are detected memory leaks. All the elements of the xml file appear like a memory leak.
The function that creates the SAXParser is like this:
CMySaxHandler errHandler; CSaxHandlerEspecificacio advHandler; CString msg; int nRetorn;
advHandler.Init(this);
XMLPlatformUtils::Initialize();
SAXParser parser; SAXParser::ValSchemes valScheme = SAXParser::Val_Always;
parser.setDoValidation(true); // optional parser.setValidationScheme(valScheme) ; parser.setDoSchema(true);
parser.setDoNamespaces(true); // optional parser.setValidationSchemaFullChecking(true); parser.setErrorHandler(&errHandler);
parser.installAdvDocHandler(&advHandler);
try { parser.parse(m_strEspFile); } catch (const XMLException& toCatch) { ......
} XMLPlatformUtils::Terminate();
I would know what is the problem, because I undertand that the function Terminate delete all the memory used by the parser.
Thanks in Advance
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
