FIX: Memory leak if many different workflow types are loaded in a .NET Framework 4-based application

Article ID: 2534614 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Assume that you run a Microsoft .NET Framework 4-based application or service that hosts different types of workflows. The workflows use many Microsoft Visual Basic expressions. When many workflow types are loaded in the application or in the service, a memory leak occurs in the application or in the service. For example, the value of the Private Bytes counter in Performance Monitor increases continuously. Additionally, if you check the memory dump, you notice that the size of the managed heap does not increase. However, the unmanaged heap occupies a large amount of memory.

CAUSE

This issue occurs because some native data structures that are used to compile the Visual Basic expressions are not released.

RESOLUTION

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:
http://support.microsoft.com/contactus/?ws=support
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

To apply this hotfix, you must have the .NET Framework 4 installed.

Restart requirement

You have to restart the computer if the affected files are being used when you install this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File Information

The global version of this hotfix package uses a Microsoft Windows Installer package to install the hotfix package. The dates and the times for these files are listed in Coordinated Universal Time (UTC) in the following table. When you view the file information, the date is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
For all supported x86-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, and of Windows 7
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
System.activities.core.presentation.dll4.0.30319.467618,37611-May- 201105:13x86
System.activities.dll4.0.30319.4671,221,98411-May- 201105:13x86
System.activities.presentation.dll4.0.30319.4671,558,90411-May-201105:13x86
For all supported x64-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, of Windows 7, and of Windows Server 2008 R2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
System.activities.core.presentation.dll4.0.30319.467618,37611-May- 201105:13x64
System.activities.dll4.0.30319.4671,221,98411-May- 201105:13x64
System.activities.presentation.dll4.0.30319.4671,558,90411-May-201105:13x64
For all supported IA-64-based versions of Windows Server 2003, of Windows Server 2008, and of Windows Server 2008 R2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
System.activities.core.presentation.dll4.0.30319.467618,37611-May- 201105:13IA-64
System.activities.dll4.0.30319.4671,221,98411-May- 201105:13IA-64
System.activities.presentation.dll4.0.30319.4671,558,90411-May-201105:13IA-64

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

When a workflow type is loaded, the following operations occur:
  • A workflow tree is created.
  • An expression tree is created for each Visual Basic expression in the workflow tree.
  • A HostedCompiler instance is used to compile the Visual Basic expression string into an expression tree.
The instances are cached in a dictionary. Therefore, the HostedCompiler instance is not re-created. The instances are keyed in the dictionary by a closure set of assemblies that are referenced by the Visual Basic expression. Therefore, the HostedCompiler instances are reused if the set of referenced assemblies remains the same. The number of items in the cache is set to 10 in order to control the overall memory footprint.

When a Visual Basic expression is compiled and there is no suitable HostedCompiler instance in the cache, a new HostedCompiler instance is created. If the cache is full, a HostedCompiler instance is removed from the cache before the new one is added. However, the native data structures that are associated with the removed HostedCompiler instance are not released.

Properties

Article ID: 2534614 - Last Review: November 21, 2011 - Revision: 2.0
APPLIES TO
  • Windows Workflow Foundation 4.0
  • Microsoft Windows Workflow Services
Keywords: 
kbqfe kbfix kbhotfixserver kbexpertiseadvanced kbsurveynew KB2534614

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com