I'm using an IDOM document as an internal data structure in my application.
The code overwrites the value of some attributes many times. The problem is,
that the memory of my application increases very fast.

For simulation of this problem, i use the following code

void test()
{
        XMLPlatformUtils::Initialize();

        XMLCh tempStr[4000];
        XMLCh tempStr2[4000];
        XMLCh tempStr3[4000];
        XMLString::transcode("status", tempStr, 3999);
        XMLString::transcode("true", tempStr2, 3999);
        XMLString::transcode("root", tempStr3, 3999);

        //create document
        IDOM_Document*  cpXMLDocument;
        cpXMLDocument =
IDOM_DOMImplementation::getImplementation()->createDocument();
        //create root element
        IDOM_Element*   cpRoot = cpXMLDocument->createElement(tempStr3);
        //create status attribute
        cpRoot->setAttribute(tempStr,tempStr2);
        IDOM_Attr* pAttr = cpRoot->getAttributeNode(tempStr);

        //simulate setting the attribute value
        for(int i=0;i<200000;i++)
        {
                pAttr->setValue(tempStr2);
                //same problem
                //cpRoot->removeAttribute(tempStr);
                //cpRoot->setAttribute(tempStr,tempStr2);
        }
        delete cpXMLDocument;

        XMLPlatformUtils::Terminate();
        cout << "the end" << endl;
}

my application grows up to 12 MB.

Am I right, that the allocated memory for changed attributes will
be deallocated only at deletion of the whole document?
Is there any chance to get the memory of removed/changed attributes back
without
deleting the whole document?

Thanks!

markus

+----------------------------------------------+
|                                              |
|  |\/\/\/|         M a r k u s  F e l l n e r |
|  |      |                      Plecherstr. 6 |
|  C-(o)(o)                      81541 M�nchen |
|  |      _)            Mobil: +49-170-5339667 |
|  | ,___|                Tel: +49-89-6514699  |
|  |    /                 Fax: +49-89-69372952 |
|  /____\       mailto:[EMAIL PROTECTED] |
|                                              |
+----------------------------------------------+



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to