P
polism
Hi,
I have the following simple code, using xerces running on my windows.
This demo compiles and runs normally, but when I open my Task Manager,
I see a constant memory growth of my process, and I dont understand
why.
//***********************************************
XMLPlatformUtils::Initialize();
DOMImplementation impl =
DOMImplementationRegistry::getDOMImplementation(...);
DOMDocument* doc1 = impl->createDocument(...);
DOMDocument* doc2 = impl->createDocument(...);
DOMElement* elem1 = doc1->createElement(...);
DOMElement* elem2 = doc2->createElement(...);
// get elem2 to be realy big element, so that memory leak will be more
visible
DOMElement* tmp = doc2->createElement(...);
for(int i=0; i<50; i++)
{
elem2->appendChild(tmp);
}
DOMNode* node;
while(true)
{
// thread sleep for 20 msec
Sleep(20);
node = doc1->importNode(elem2, true);
node->release();
}
//****************************************************
I understand that importNode() actualy clones the original node, but
release() is supposed to free it, and it seems that it doesn't happen.
What is wrong here? please help.
thanx ahead,
Mike
I have the following simple code, using xerces running on my windows.
This demo compiles and runs normally, but when I open my Task Manager,
I see a constant memory growth of my process, and I dont understand
why.
//***********************************************
XMLPlatformUtils::Initialize();
DOMImplementation impl =
DOMImplementationRegistry::getDOMImplementation(...);
DOMDocument* doc1 = impl->createDocument(...);
DOMDocument* doc2 = impl->createDocument(...);
DOMElement* elem1 = doc1->createElement(...);
DOMElement* elem2 = doc2->createElement(...);
// get elem2 to be realy big element, so that memory leak will be more
visible
DOMElement* tmp = doc2->createElement(...);
for(int i=0; i<50; i++)
{
elem2->appendChild(tmp);
}
DOMNode* node;
while(true)
{
// thread sleep for 20 msec
Sleep(20);
node = doc1->importNode(elem2, true);
node->release();
}
//****************************************************
I understand that importNode() actualy clones the original node, but
release() is supposed to free it, and it seems that it doesn't happen.
What is wrong here? please help.
thanx ahead,
Mike