Article ID: 316775 - Last Review: July 29, 2011 - Revision: 4.0 PRB: Cannot unload assemblies that you create and load by using script in XSLT
This article was previously published under Q316775
This article refers to the following Microsoft .NET Framework Class Library namespaces:
On This PageSYMPTOMS
When you use the <msxsl:script> element repeatedly with System.Xml.Xslt framework, a memory leak may occur with a high volume Extensible Markup Language (XML) or Extensible Stylesheet Language (XSL) application.
CAUSE
The classes of the System.Xml namespace support the use of embedded scripting by using the script element in XSL Transformation (XSLT) applications. Therefore, the <msxsl:script> element allows you to choose the programming language (such as Microsoft Visual C# .NET or Microsoft Visual Basic .NET) to perform certain tasks. Declared functions are contained within script blocks. When you use embedded script with an XSL file, an assembly that contains Microsoft Intermediate Language (MSIL) is created and loaded into memory. Because of a design limitation in this version of the Microsoft .NET Framework, you cannot unload that assembly from memory. This may lead to a memory leak if assemblies are created and loaded repeatedly or in a loop. RESOLUTION
To resolve this problem, do not repeatedly load the XSLT with the script. Develop your application in such a way that you load the XSLT once and reuse it as many times as needed. This practice also improves performance. For example, the following code leaks memory: WORKAROUNDUnload an individual assembly by unloading all the application domains that contain the assembly. To do this, call the AppDomain.Unload() method for each application domain that has the assembly loaded, or call the UnloadDomain() method on the unmanaged hosting API. MORE INFORMATIONSteps to reproduce the behavior
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
