I have taken a look at an example i found on the internet of xerces generating XML. The Transcode function seems to perform some encoding but the buffer it populates to is never released. According to the documentation you must release ti manually:
NOTE: The returned buffer is dynamically allocated and is the responsibility of the caller to delete it when not longer needed. You can call XMLString::release to release this returned buffer.
could doc->release be releasing this from memory?
XMLCh tempStr[100];
XMLString::transcode("Range", tempStr, 99);
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(tempStr, 0);
XMLString::transcode("root", tempStr, 99);
DOMDocument* doc = impl->createDocument(0, tempStr, 0);
DOMElement* root = doc->getDocumentElement();
XMLString::transcode("FirstElement", tempStr, 99);
DOMElement* e1 = doc->createElement(tempStr);
root->appendChild(e1);
XMLString::transcode("SecondElement", tempStr, 99);
DOMElement* e2 = doc->createElement(tempStr);
root->appendChild(e2);
doc->release();