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 xe...@xml.apache.org on 2004/07/27 04:15:17 UTC

[jira] Resolved: (XERCESC-1245) Memory Leak on Schema Validation Failure

Message:

   The following issue has been resolved as FIXED.

   Resolver: Alberto Massari
       Date: Mon, 26 Jul 2004 7:14 PM

Thanks for the test case: strictly speaking we don't have a leak here, as the memory if freed when you delete the validator object. The problem is that the stack used to do validation was not reset, so it grew undefinitely.

A fix is in CVS; please verify it works for you.
Alberto
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESC-1245

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESC-1245
    Summary: Memory Leak on Schema Validation Failure
       Type: Bug

     Status: Resolved
   Priority: Major
 Resolution: FIXED

    Project: Xerces-C++
 Components: 
             Validating Parser (Schema) (Xerces 1.5 or up only)
   Versions:
             Nightly build (please specify the date)

   Assignee: 
   Reporter: Simon Kitching

    Created: Mon, 26 Jul 2004 2:07 AM
    Updated: Mon, 26 Jul 2004 7:14 PM
Environment: Linux (Debian Sarge), i686, uniprocessor

Description:
I've got a test harness that loads a schema explicitly, then repeatedly
parses an XML document.

When the XML document is valid according to the schema, all is fine.
I can watch /proc/{pid}/status and the VmSize/VmData fields are steady.

But when it is not valid (ie parse reports a validation error to the
ErrorHandler, which throws an exception), a memory leak occurs. The
VmSize/VmData fields creeps steadily upward as repeated parse-fail cycles occur.

I will attach a test harness that demonstrates this problem.

This problem occurs on both the 2.5.0 release, and the nightly snapshot xml-xerces_20040725043234.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


Re: On references to DOMElements

Posted by Markus <ma...@mail.student.oulu.fi>.
That works! Thanks!

markus

> Maybe you are looking for one of this:
> void myFunc(DOMElement *& e1, DOMElement *& e2) {
> e1 = doc->doSomethingThatReturnsPointerToElement();
> e2 = doc->doSomethingElseThatReturnsPointerToElement();
> }


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


Re: On references to DOMElements

Posted by Vitaly Prapirny <ma...@mebius.net>.
Hi,
Markus Harju wrote:
> void myFunc(DOMElement& e1, DOMElement& e2)
> {
>         e1 = doc->doSomethingThatReturnsElement(); // compiler error
>         e2 = *(doc->doSomethingThatReturnsElement());//compiler error here
> too
> }
Maybe you are looking for one of this:
void myFunc(DOMElement *& e1, DOMElement *& e2) {
	e1 = doc->doSomethingThatReturnsPointerToElement();
	e2 = doc->doSomethingElseThatReturnsPointerToElement();
}
  or
void myFunc(DOMElement *& e1, DOMElement *& e2) {
	e1 = (DOMElement*)
		(doc->doSomethingThatReturnsPointerToElement()
			->cloneNode(true));
	e2 = (DOMElement*)
		(doc->doSomethingElseThatReturnsPointerToElement()
			->cloneNode(true));
}

Good luck !


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


On references to DOMElements

Posted by Markus Harju <ma...@mail.student.oulu.fi>.
Hello,

as some of you may know I'm taking an app
from xerces 1.7.0 towards 2.5.0. In the past
one could have a function receiving a reference
to a DOMElement and modify it like this
(with underscores in 1.7.0)

void myFunc(DOMElement& e1, DOMElement& e2)
{
        e1 = doc.doSomethingThatReturnsElement();
        e2 = doc.doSomethingElseThatReturnsElement();
}

How would I go about doing the same in, say, 2.1.0 ?

There the DOM functions usually return a pointer
to a DOMElement. Hence this won't compile
anymore...

void myFunc(DOMElement& e1, DOMElement& e2)
{
        e1 = doc->doSomethingThatReturnsElement(); // compiler error
        e2 = *(doc->doSomethingThatReturnsElement());//compiler error here
too
}

I'm on VS7.1. and Win2000.

TIA,

Markus


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