Subject:Memory problems Author:Adam Van den Hoven Date:07 Sep 2001 05:29 PM
Hey guys,
I've discovered some really scarry memory issues, I'm attaching the files I used. If I step through the code, within a few steps my memory usage shoots up. If I keep going, or simply run without steping, I quickly run out of virtual memory and have to do a hard reboot. The problem seems to be tied with the use of variables containing nodesets since if I store strings (via the string() function) the problem is greatly reduced.
Here's what my rough measurement of the problem. What I did was open all the files I've attached and then place a breakpoint on the {xsl:template match='/'} line. I then recorded the total memory usage (as reported by the statusbar of taskmanager) before running. I then started the processor and recored the memory at step 0. Each time I pressed F11, I recorded the memory usage and the line where the arrow was pointing after pressing F11 (so after the first step the pointer was on the comment line). Once the memory usage approached 600megs, I quit the process, restarted stylus studio and ran the _fixed template in the exact same fashion
Open Files:
getItemResourceURL.xsl
getItemResourceURL_fixed.xsl
Configlib.xsl
config.xml
In both getItem*.xsl files place a breakpoint on the line:
step through the original then the _fixed files
Memory Usage
Step
usage
Pointer on
before
123072
0
193212
template match="/"
1
192992
Comment line
2
193008
first variable
3
196136
Second variable line
4
254808
Call-template line
5
255684
template name=ResolvePath in config.xsl
6
255796
path pathnodes
7
254836
path pathid
8
309532
path pathtype
9
420444
variable CurrentPath
10
Quit the process when the memory usage got over 590000k
Subject:Memory problems Author:Adam Van den Hoven Date:07 Sep 2001 05:32 PM
OOps here are the rest... and those tables (I thought it was going to reneder the HTML correctly) in tab delimited:
orig
Memory Usage
Step orig Pointer on
before 123072
0 193212 template match="/"
1 192992 Comment line
2 193008 first variable
3 196136 Second variable line
4 254808 Call-template line
5 255684 template name=ResolvePath in config.xsl
6 255796 path pathnodes
7 254836 path pathid
8 309532 path pathtype
9 420444 variable CurrentPath
10 Quit the process when the memory usage got over 590000k
_fixed:
Memory Usage
Step orig Pointer on
before 124180
0 193004 template match="/"
1 193008 Comment line
2 192128 first variable
3 197076 Second variable line
4 197056 Call-template line
5 197092 template name=ResolvePath in config.xsl
6 197096 path pathnodes
7 197100 path pathid
8 197100 path pathtype
9 197104 variable CurrentPath
10 197120 choose
Subject:Re: Memory problems Author:Minollo I. Date:10 Sep 2001 03:43 PM
Adam,
we have worked hard during the weekend to understand the source of the
problem you have reported. We have found a couple of issues that were
making the XPath processor leak huge amounts of memory when executed on the
type of XPath expressions you are using, and also a big performance issue
when working on variables containing node-sets (as you suspected).
The good news is that we have been able to fix both issues, and that now
your testcase stylesheet is processed in less than two seconds (compared to
a similar result using MSXML and to about 5 minutes using Xalan-J) with
stable memory consumption.
We are now running regression tests; if everything goes smoothly we will
release a build containing these (and other fixes) later this night or
tomorrow.