You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/07/09 17:12:45 UTC
DO NOT REPLY [Bug 10593] New: -
Recursion limits, excessive memory consumption [patch attached]
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10593>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10593
Recursion limits, excessive memory consumption [patch attached]
Summary: Recursion limits, excessive memory consumption [patch
attached]
Product: XalanJ2
Version: 2.4Dx
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: org.apache.xpath
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: nboyd@atg.com
org.apache.xpath.XPathContext defines a constant RECURSIONLIMIT and several
arrays that are allocated with that length and whose bounds are never checked.
This causes two problems: the potential for ArrayIndexOutOfBoundsExceptions and
excessive memory consumption by programs that make repeated use of XPath
expressions.
We had a customer who was using XPath to select nodes to compose a page to
display on the web and was generating on the order of 160Mb of garbage *per
request*.
The attached patch removes RECURSIONLIMIT and replaces it with an initial stack
size. When elements are pushed onto the arrays, the size of the array is checked
and the array is grown if need be. I removed two getter methods for retrieving
the array since that array may be replaced by a larger array without notification
of the caller.
In our tests, these changes improved performance by reducing the pressure on the
garbage collector. Our tests didn't see any array growth for the proposed
initial stack size value.
To test the changes, I set the initial size of the arrays to 2 and ran several
of the samples through, including ApplyXPath. At this artificially low level,
I saw several arrays grow.