DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7675>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7675

IDOM memory management problem

           Summary: IDOM memory management problem
           Product: Xerces-C++
           Version: 1.7.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The memory of removed nodes is not deallocated before deletion of the whole 
IDOM document. 
If e.g. a value of an attribute is overwritten many times during lifetime of 
the document, the memory increases very fast.
Look at 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;
}

The Memory for my application grows up to 12 MB during these 200000 loops.

Best,

Markus

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

Reply via email to