[EMAIL PROTECTED] wrote:
Hi,
We are using Xerces-C++ (version 2.6) on Linux platform in our project
“Device Agent software” for XML parsing and persist the data in XML
file at run time.
...
When we tried the Agent software memory leak analysis through Purify, we
found that for every write operation, lot of memory (around 100KB each time)
There were some memory leak problems with 2.6, so you might try upgrading to 2.7 to see if that fixes the problem you're
seeing.
is getting leaked. For every write operation, Agent Software does
creation of small XML file, parsing the same through SAX parser against
the predefined
...
Are we missing something? Is there some problem in the way we used the
Xerces-C++ APIs? Are there any apis to be called to free the Xerces
allocated memory?
The most common mistake is using XMLString::transcode() and not freeing the pointer that is returned through
XMLString::release().
...
_New memory leaked: 112020 bytes (3.04%); potentially leaked: 140 bytes
(0.0038%)_
*_MLK: 65536 bytes leaked at 0x8788100_*
This memory was allocated from:
malloc [rtlib.o]
operator new(unsigned) [libstdc++.so.5]
xercesc_2_6::MemoryManagerImpl::allocate(unsigned)
[MemoryManagerImpl.cpp:46]
{
void* memptr;
try {
* => memptr = ::operator new(size);*
}
catch(...) {
throw OutOfMemoryException();
xercesc_2_6::DOMDocumentImpl::allocate(unsigned)
[DOMDocumentImpl.cpp:850]
// Get a new block from the system allocator.
void* newBlock;
* => newBlock =
fMemoryManager->allocate(kHeapAllocSize * sizeof(char)); //new
char[kHeapAllocSize];*
*(void **)newBlock = fCurrentBlock;
fCurrentBlock = newBlock;
operator new(unsigned, xercesc_2_6::DOMDocument*)
[DOMDocumentImpl.hpp:378]
inline void * operator new(size_t amt,
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc)
{
// revist. Probably should be a checked cast.
* => void *p = ((XERCES_CPP_NAMESPACE_QUALIFIER
DOMDocumentImpl *)doc)->allocate(amt);*
return p;
}
Xerces-C's DOM implementation pools memory at the document level, and much of that memory is not freed until the
document is destroyed. You should verify you're actually deleting the document when you're through with it.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]