[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-dev
Subject:    [jira] Created: (XERCESC-1692) A createElement() - relase() call
From:       "Luzius Blatter (JIRA)" <xerces-c-dev () xml ! apache ! org>
Date:       2007-04-03 14:47:32
Message-ID: 8518074.1175611652327.JavaMail.jira () brutus
[Download RAW message or body]

A createElement() - relase() 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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic