473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How does Xerces C++ release DOMNodeList object?

Hi All,

Problem: Call to DOMDocument::getElementsByTagName() in a loop causes
growth in memory consumption?

Consider the following lines of code which simulates the problem
that I am facing.

/////////////////////////////////////////////////////////////////
m_doc = m_parser->getDocument() ;

char * usnLookUpValue = new char[10];
char dest[10] = {0};
int iIndex = 0;

while(1)
{
memcpy(usnLookUpValue,dest,10);
sprintf(usnLookUpValue,"U%d",iIndex++);
XMLCh* fUnicodeForm = XMLString::transcode(usnLookUpValue);

DOMNodeList* resultNodes = NULL;
resultNodes = m_doc->getElementsByTagName(fUnicodeForm);

XMLString::release(&fUnicodeForm);
if(iIndex > 50000)
{
iIndex = 0;
break;
}
}
delete usnLookUpValue;
delete m_Serializer ;
delete m_parser;

XMLPlatformUtils::Terminate();
//////////////////////////////////////////////////////////////////

The call to "getElementsByTagName" in the loop causes growth in memory
consumption until the Parser object is deletetd.

As per my understanding of Xerces C++ DOM there is no need to release
the object returned by getElementsByTagName which is owned by
implementation. The memory associated to these objects are released
when we release the Document object.

What can be the solution/alternative to prevent the rise in memory
consumption?
Any pointers would be welcome.

thanks and regards,
Girish

Aug 10 '05 #1
0 1338

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: bugbear | last post by:
Subject pretty much says it all. I'd like to parse XML (duh!) using Xerces (because its fast, and reliable, and comprehensive, and supports lots of features). I'd like to conform to standards...
4
by: David | last post by:
Hello , I'm trying to parse an XML document a get spicific tags such as email in the code below. I'm using xerces 2.4. However I don't manage to get the value for the email. Can anybody help. ...
1
by: Peter Saffrey | last post by:
I am hoping to use the Xerces libraries to read and process XML files for my applications. What I want is to parse some XML and extract information from particular tags, something which should be...
4
by: cgparis | last post by:
Dear forum members, I am trying to compile C++ code under MS Visual Studio .NET 2003, which references the latest Xerces C++ release library (2.6.0). This Xerces release was made available...
1
by: Benjamin Black | last post by:
Hello, I'm trying to get some code that uses the Xerces library (XML parsing) to run in Visual C++ 2005 Express. I've linked the library (xerces-c_2D.lib) and the \lib and \include locations to the...
1
by: Matthias Braun | last post by:
Hilfe! Ich habe mir eine Xerces C++ Routine geschrieben, die alle Dokumente des XML-Trees parst. Die folgende rekursive Funktion funktioniert allerdings nicht 100%. Wer kann helfen? Danke,...
7
by: Meal | last post by:
The last line of the following codes makes the program crash. I cannot debug into the codes. It looks that I cannot use the dynamic_cast, but why? The cout shows that the node is DOM element node....
3
by: mearvk | last post by:
I am unable to get Xerces to write out attributes from a struct which I am able to print out and verify is correct. The structs are defined below as is subsection of the output. int...
2
by: Boris Kolpackov | last post by:
Hi, I am pleased to announce the availability of Apache Xerces-C++ 3.0.0. Xerces-C++ is an open-source validating XML parser written in a portable subset of C++. It provides DOM (level 1, 2, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.