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 Simon Kitching <si...@ecnetwork.co.nz> on 2004/07/23 09:50:15 UTC

Apparent memory leak from SAX2XMLReader on parse failure

Hi,

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 field is 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 field creeps steadily upward as repeated parse-fail cycles occur.

Is there some kind of "reset" method that needs to be called after an
ErrorHandler throws an exception in order for an SAX2XMLReader instance
to correctly clean up before its next parse?

If anyone is interested, I can post the source code that demonstrates
this problem.

I'm using the 2.5.0 release of Xerces-c, on Linux (debian Sarge) with
g++ 3.3.4.

Regards,

Simon


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


Re: Apparent memory leak from SAX2XMLReader on parse failure

Posted by da...@us.ibm.com.
Hi Simon,

I reported such a bug earlier, although you may be seeing a different
issue.  You might want to look at the latest CVS and see if you can
retrofit some patches for the scanners into 2.5.0.  In particular, take a
look at src/xercesc/internal/IGXMLScanner2.cpp, at a patch in
IGXMLScanner::scanReset().

Dave



|---------+--------------------------->
|         |           Simon Kitching  |
|         |           <simon@ecnetwork|
|         |           .co.nz>         |
|         |                           |
|         |           07/23/2004 12:50|
|         |           AM              |
|         |           Please respond  |
|         |           to xerces-c-dev |
|---------+--------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                      |
  |        To:      xerces-c-dev@xml.apache.org                                                                                          |
  |        cc:      (bcc: David N Bertoni/Cambridge/IBM)                                                                                 |
  |        Subject: Apparent memory leak from SAX2XMLReader on parse failure                                                             |
  >--------------------------------------------------------------------------------------------------------------------------------------|



Hi,

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 field is 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 field creeps steadily upward as repeated parse-fail cycles occur.

Is there some kind of "reset" method that needs to be called after an
ErrorHandler throws an exception in order for an SAX2XMLReader instance
to correctly clean up before its next parse?

If anyone is interested, I can post the source code that demonstrates
this problem.

I'm using the 2.5.0 release of Xerces-c, on Linux (debian Sarge) with
g++ 3.3.4.

Regards,

Simon


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




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