Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 293080 - Last Review: October 16, 2002 - Revision: 1.4
FIX: Memory Leak on addParameter with Cached XSL Template at ASP Application Level
This article was previously published under Q293080
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.
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Â
(http://kbalertz.com/Feedback.aspx?kbNumber=292935/EN-US/
)
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:
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("MSXML2.FreeThreadedDOMDocument.3.0")
oXSLDocument.async = False
oXSLDocument.load(Server.MapPath("test.xsl"))
Dim oXSLTemplate
Set oXSLTemplate = Server.CreateObject("MSXML2.XSLTemplate.3.0")
Set oXSLTemplate.stylesheet = oXSLDocument
Set Application("CachedTemplate") = 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("MSXML2.DOMDocument.3.0")
oInputDoc.loadXML "<Test>" & Now() & "</Test>"
Set oResourceDoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
oResourceDoc.loadXML "<Resources/>"
Set oXSLProcessor = Application("CachedTemplate").createProcessor()
oXSLProcessor.input = oInputDoc
oXSLProcessor.output = Response
'Remove this line to stop the leak.
oXSLProcessor.addParameter "resources", oResourceDoc.documentElement
oXSLProcessor.transform()
Set oResourceDoc = Nothing
Set oInputDoc = Nothing
Set oXSLProcessor = Nothing
%>
- Save the following code as Test.xsl:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="http://support.microsoft.com">
XSL output: <xsl:value-of select="Test" />
</xsl:template>
</xsl:stylesheet>
- Test the application under stress:
- Set up a new virtual folder and copy File1.asp, File2.asp, and Test.xsl to the virtual folder.
- 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.
- From your browser, run File1.asp.
- From your browser, run File2.asp repeatedly.
- 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.
| kbbug kbfix kbmsxml300sp1fix kbmsxmlnosweep KB293080 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate