You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Luzius Blatter (JIRA)" <xe...@xml.apache.org> on 2007/04/04 18:15:32 UTC

[jira] Updated: (XERCESC-1692) A createElement() - release() call sequence doesn't release the allocated memory. The memory is blocked until the document is released.

     [ https://issues.apache.org/jira/browse/XERCESC-1692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luzius Blatter updated XERCESC-1692:
------------------------------------

    Summary: A createElement() - release() call sequence doesn't release the allocated memory. The memory is blocked until the document is released.  (was: A createElement() - relase() call sequence doesn't release the allocated memory. The memory is blocked until the document is released.)

> A createElement() - release() call sequence doesn't release the allocated memory. The memory is blocked until the document is released.
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-1692
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1692
>             Project: Xerces-C++
>          Issue Type: Wish
>          Components: DOM
>    Affects Versions: 2.7.0
>         Environment: Windows XP
> Mircosoft MSVC 8.0 (Visual Studio 2005)
>            Reporter: Luzius Blatter
>
> // We have long jobs over night where DOM documents are manipulated 
> // with frequent "AddChild" and "RemoveChild" calls. 
> // The documents are released at the end of the jobs.      
> //  
> // Now we have the problem the the system goes out of memory. 
> // The reason is that all memory allocations aren't deallocated before 
> // the the document is released.
> // 
> // My wish is: I would like to release DOM elements with a true memory deallocation.
> //  
> // The following code fragment shows the problem:
> //
> // Get the DOM implementation
> DOMImplementation *pDOMImplementation = DOMImplementationRegistry::getDOMImplementation(NULL);
> // Create a DOM document 
> XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocument = pDOMImplementation->createDocument();
> // Create and release many DOM elements
> int iElement = 0;
> while(iElement < 1000000)
> {  
>   // Create a element:
>   DOMElement *pElement = pDocument->createElement(L"A");
>   // Release the element:
>   pElement->release();
>   //Note: Although the orphaned element is now released, the memory  remains blocked 
>   //      and can't be reused (even not for the next element in the loop!)
>   iElement++;
> }
> // Now we have around 24 MB blocked. 
> pDocument->release();
> //Note: Now the memory is deallocated and can be reused.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org