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

Scott Cantor closed XERCESC-1692.
---------------------------------

> 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 was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to