logo       

importNode() / release() memory growth problem in Xerces-C++.....please hel: msg#00088

text.xml.xerces-c.user

Subject: importNode() / release() memory growth problem in Xerces-C++.....please help

Hi, this is the second time I send this message, sorry for that, its just
that I am not sure it got sent
the first time, since I didn't receive any responces.

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
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise