Microsoft KB Archive/293080

= FIX: Memory Leak on addParameter with Cached XSL Template at ASP Application Level =

Article ID: 293080

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft XML Core Services 4.0

-



This article was previously published under Q293080



SYMPTOMS
After you add an XMLDOMDocument or XMLDOMNode object to an Extensible Stylesheet Language (XSL) template that is cached in an Active Server Pages (ASP) Application variable, and you set an XSLProcessor object in a second ASP page to use the cached Application level template as a parameter, the XSLProcessor object's transform method consumes a large amount of memory.

You only see memory usage grow if the XSL template is cached at the ASP Application level. You do not see the memory leak if you create a new XSL template every time that the XSLProcessor object is used.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Microsoft XML 3.0 Service Pack 1.

For additional information on other fixes included in Microsoft XML 3.0 Service Pack 1, click the article number below to view the article in the Microsoft Knowledge Base:

292935 INFO: List of Issues Fixed in Microsoft XML 3.0 Service Pack 1

For the latest information and downloads of MSXML, refer to the following MSDN Web site at:

http://msdn.microsoft.com/xml/default.asp



Steps to Reproduce Behavior
  Save the following code as File1.asp: <% '============================================= ' File1.asp - Run once to cache the template ' in an Application object.

Dim oXSLDocument Set oXSLDocument = Server.CreateObject(&quot;MSXML2.FreeThreadedDOMDocument.3.0&quot;) oXSLDocument.async = False oXSLDocument.load(Server.MapPath(&quot;test.xsl&quot;))

Dim oXSLTemplate Set oXSLTemplate = Server.CreateObject(&quot;MSXML2.XSLTemplate.3.0&quot;) Set oXSLTemplate.stylesheet = oXSLDocument

Set Application(&quot;CachedTemplate&quot;) = oXSLTemplate

Set oXSLDocument = Nothing Set oXSLTemplate = Nothing %>                     Save the following code as File2.asp: <% '============================================= ' File2.asp - Each run consumes memory, without ' releasing it.

Dim oInputDoc Dim oResourceDoc Dim oXSLProcessor

Set oInputDoc = Server.CreateObject(&quot;MSXML2.DOMDocument.3.0&quot;) oInputDoc.loadXML &quot;&quot; & Now & &quot;&quot;

Set oResourceDoc = Server.CreateObject(&quot;MSXML2.DOMDocument.3.0&quot;) oResourceDoc.loadXML &quot;&quot;

Set oXSLProcessor = Application(&quot;CachedTemplate&quot;).createProcessor oXSLProcessor.input = oInputDoc oXSLProcessor.output = Response

'Remove this line to stop the leak. oXSLProcessor.addParameter &quot;resources&quot;, oResourceDoc.documentElement

oXSLProcessor.transform

Set oResourceDoc = Nothing Set oInputDoc = Nothing Set oXSLProcessor = Nothing %>                     Save the following code as Test.xsl:    XSL output: <xsl:value-of select=&quot;Test&quot; /> </xsl:template> </xsl:stylesheet> </li> Test the application under stress: <ol style="list-style-type: lower-alpha;"> Set up a new virtual folder and copy File1.asp, File2.asp, and Test.xsl to the virtual folder.</li> Configure the new virtual folder to run in High Isolation - Out of Process, so that the ASP application runs under a separate copy of Dllhost.exe.</li> From your browser, run File1.asp.</li> From your browser, run File2.asp repeatedly.</li> To view memory usage, start Windows Task Manager and click the Processes tab. One instance of Dllhost.exe shows linear growth in memory usage, corresponding to the memory leak.</li></ol> </li></ol>

Keywords: kbbug kbfix kbmsxml300sp1fix kbmsxmlnosweep KB293080

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.