Hi Dave I think introducing the below line in my code should free the XMLReader. delete pParser Pls let me know, if there is any other way of doing this.
Thanks Karuna -----Original Message----- From: David Bertoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 30, 2007 2:22 PM To: [email protected] Subject: Re: MemoryLeaks in Xerces Kosaraju Karuna-C9013Z wrote: > Hi, > > We have designed a tool to read the XML file using SAX Parser. > Our tool has two interface APIs, initialize() and terminate(). > In the Initialize method, we do invoke > > -XMLPlatformUtils::Initialize(); followed by, > > pParser=XMLReaderFactory::createXMLReader(); ... > > When we just invoke initialize and terminate, we do see some memory > leaks. The purify shows somethindg as below > > PLK: 9856 bytes potentially leaked in 176 blocks > * This memory was allocated from: > malloc [rtlib.o] > operator new(unsigned) [libstdc++.so.5] operator new(unsigned) [] > xercesc_2_6::MemoryManagerImpl::allocate(unsigned) > [MemoryManagerImpl.cpp:46] > xercesc_2_6::XMemory::operator new(unsigned, > xercesc_2_6::MemoryManager*) [XMemory.cpp:66] > xercesc_2_6::IGXMLScanner::scanStartTagNS(bool&) > [IGXMLScanner.cpp:2367] > * Block of 56 bytes (176 times); last block at 0x816dbe0 Did you delete the XMLReader instance you created in the call to XMLReaderFactory::createXMLReader()? > > PLK: 9448 bytes potentially leaked in 2 blocks > * This memory was allocated from: > malloc [rtlib.o] > operator new(unsigned) [libstdc++.so.5] operator new(unsigned) [] > std::__default_alloc_template<true, 0 >::_S_chunk_alloc(unsigned, > int&) [libstdc++.so.5] std::__default_alloc_template<true, 0 > >::_S_refill(unsigned) [libstdc++.so.5] > std::__default_alloc_template<true, 0 >::allocate(unsigned) > [libstdc++.so.5] > * Block of 4776 bytes at 0x80c1300 > * Block of 4672 bytes at 0x80bf6b8 Xerces-C doesn't use any templates from the standard library, so this may be a spurious report, or a leak in your code. Dave
