Hi,
this is expected. Not all the memory associated with the element is released (for example the attribute list in elements).


Gareth

On 21 Sep 2004, at 9:01, [EMAIL PROTECTED] wrote:

Hello xerces-c-dev,


Xerces-C version number - 2.5.0 Platform - Intel Pentium 4 Operating system and version number - Microsoft Windows 2000 AS Compiler and version number - cygwin (Visual C 7.0) The C application code that failed: //-------------------------------------------------------- --------------------------- #include <stdio.h> #include <conio.h> #include <xercesc/dom/DOM.hpp>

XERCES_CPP_NAMESPACE_USE

int main(int argc, char* argv [])
{
        XMLPlatformUtils::Initialize();

        XMLCh * xml_str;

        DOMImplementation* impl =
DOMImplementationRegistry::getDOMImplementation(0);

        xml_str = XMLString::transcode( "root" );
        DOMDocument*   doc = impl->createDocument(0,
xml_str, 0);
        XMLString::release( &xml_str );
        DOMElement*   root = doc->getDocumentElement();

        xml_str = XMLString::transcode( "FirstElement" );
        DOMElement*   e1 = doc->createElement(xml_str);
        XMLString::release( &xml_str );
        root->appendChild(e1);

        xml_str = XMLString::transcode( "SecondElement" );
        DOMElement*   e2 = doc->createElement(xml_str);
        XMLString::release( &xml_str );
        root->appendChild(e2);

        xml_str = XMLString::transcode( "aTextNode" );
        DOMText*       textNode = doc->createTextNode
(xml_str);
        XMLString::release( &xml_str );
        e1->appendChild(textNode);

        printf("Step 1\n");                     // Memory
usage 2 MB
        getch();

        for( int i=0; i<5000000; i   )
        {
              DOMNode * node = e1->cloneNode(true);
              node->release();
        }

        printf("Step 2\n");                     // Memory
usage 158 MB !!!
        getch();

        doc->release();

        printf("Step 3\n");                     // Memory
usage 7 MB
        getch();

        XMLPlatformUtils::Terminate();

        return 0;
}
//--------------------------------------------------------
---------------------------

What happened - memory usage:
  step 1 - 2 MB,
  step 2 - 158 MB (!!!),
  step 3 - 7 MB.


-- Best regards, alexch mailto:[EMAIL PROTECTED]

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



--
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com


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



Reply via email to