Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Memory leak or bad code?

422375May 31 2004 — edited Jun 30 2004
Hi there,

I’ve been experimenting with the XML parser for C++ from Release 2 (9.2) and I came up with the following situation:


I took some code from the demo folder and added a `for loop` around the createElement and appendChild.

The code looks like this:

if (ecode = parser.xmlinit())
{
cout << "Failed to initialze XML parser, error " << ecode << "\n";
return 1;
}

cout << "\nCreating new document...\n";

if (!(doc = parser.createDocument((oratext *) 0, (oratext *) 0,(DocumentType *) 0)))
FAIL


for(int i=0;i<count;i++)
{
if (!(elem = doc->createElement((oratext *) "ROOT")))
FAIL

if (!doc->appendChild(elem))
FAIL
}

parser.xmlterm();





My problem is that, after the parser.xmlterm() the memory usage is still the same. I work on a HPUX machine and the memory usage is shown in the TOP utility. Example: if count =100000, TOP shows a size and res of 227M and 205M respectively before the xmlterm and no change is shown after the xmlterm. So is there a leak or is my code not good?



A quick reply from you will be mostly appreciated,

Thank you,

Avinash.




Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2004
Added on May 31 2004
4 comments
4,690 views