Hi All,
I have encountered a memory leak problem that appears in DOMParser. I don't
know what's
the reason behind it. I use purify to perform the test and the leak shows
only on WinNT
with Xerces-C 1.5 (binary downloaded from apache.org). The same leak problem
does not show
up on Solaris when purify is used, though the ElemStack leaks do exist
there. Attached is
a test program. Please let me know if this is a real problem. Here is the
test program and
the report from purify:
-Ning Zhang
-----------
#include <util/PlatformUtils.hpp>
#include <parsers/DOMParser.hpp>
#include <dom/DOM.hpp>
#include <framework/MemBufInputSource.hpp>
#include <string.h>
#include <stdlib.h>
#include <iostream.h>
int main( int argc, char ** argv )
{
try
{
XMLPlatformUtils::Initialize();
}
catch( const XMLException& e )
{
cerr << "Error during Xerces-c Initialization" << endl;
return 1;
}
DOMParser parser;
char * str =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><addr><city/></addr>\n";
MemBufInputSource membuf((const XMLByte *) str, strlen(str), "x",
false);
parser.parse(membuf);
parser.reset();
parser.parse(membuf);
XMLPlatformUtils::Terminate();
return 0;
}
---------------------
[I] Starting Purify'd test.exe at 07/13/01 10:13:42
[I] Starting main
[I] Summary of all memory leaks... {72 bytes, 3 blocks}
[W] MLK: Memory leak of 18 bytes from 1 block allocated in
DocumentImpl::getOwnerDocument(void)
Distribution of leaked blocks
Allocation location
new(UINT,int,char const*,int) [dbgnew.cpp:46]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
main [Test.cpp:28]
mainCRTStartup [exsup.obj]
[W] MLK: Memory leak of 26 bytes from 1 block allocated in
DocumentImpl::getOwnerDocument(void)
Distribution of leaked blocks
Allocation location
new(UINT,int,char const*,int) [dbgnew.cpp:46]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
main [Test.cpp:28]
mainCRTStartup [exsup.obj]
[W] MLK: Memory leak of 28 bytes from 1 block allocated in
DocumentImpl::getOwnerDocument(void)
Distribution of leaked blocks
Allocation location
new(UINT,int,char const*,int) [dbgnew.cpp:46]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
DocumentImpl::getOwnerDocument(void) [xerces-c_1_5D.dll]
main [Test.cpp:28]
mainCRTStartup [exsup.obj]
[I] Exiting with code 0 (0x00000000)
[I] Program terminated at 07/13/01 10:13:45
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]