I'm currently struggling with rising memory usage in Xerces-C.
I was able to simplify the code to this point:
xercesc_3_2::XMLPlatformUtils::Initialize();
xercesc_3_2::DOMImplementation* impl = xercesc_3_2::DOMImplementationRegistry::getDOMImplementation((const XMLCh*)L"LS");
xercesc_3_2::DOMDocument* doc = impl->createDocument();
while (true)
{
xercesc_3_2::DOMElement* el = doc->createElement((const XMLCh*)L"root");
el->release();
}
When I execute this code, the memory usage will rise up to 4 GB in ~30 seconds.
- Do I have to call anything else than
release()
on theDOMElement
in order to free the memory? - Is there any way to truly free the memory used by a
DOMElement
without releasing theDOMDocument
Some remarks to my questions:
- I can't destroy the
DOMDocument
. (Unfortunately I have to keep it around with a lot ofDOMElement
s being created and released) - I know this is technically not a memory leak since the memory will free when i release the
DOMDocument
, but is this a known issue? - I've tested the xerces-c versions
3.1.1
,3.1.4
.3.2.2
. The problem exists in all those versions.