FIX: A memory leak occurs in the VisualBasic.VsaEngine when creating multiple assemblies
This article has been archived. It is offered "as is" and will no longer be updated.
When you use Visual Studio for Applications (VSA) in your custom solution and you compile new assemblies that use an instance of the VisualBasic.VsaEngine, you may see an increase in memory for the process working set each time a new assembly is made. The memory cannot be reclaimed by the host. Therefore, the memory is "leaked" by the process space that does the compile.
The problem does not occur when you use the Microsoft JScript VSA engine.
The problem is caused by a combination of three smaller problems. These problems are related to the ability of the Microsoft Visual Basic VSA engine to compile assemblies that are inside the host process. The following problems have been identified as causes for the leak:
- A COM Callable Wrapper (CCW) that is used during the compile process between the Microsoft .NET Framework and the native Visual Basic compiler may be retained in memory. This occurs even though the object is correctly released. This problem is not specific to VSA. This problem can be avoided if you use the fix that is provided and Close is called on the engine before the engine is released.
- When symbols are made for the assembly, the program database file (PDB) may consume memory that is not immediately reclaimed by the garbage collector. If you do not require symbols for the compiled code, you can avoid the problem. Set GenerateDebugInfo to False before the Compile method is called.
- The internal compile process can fail to release certain common language runtime handles during processing of the Visual Basic code. The number of handles that are leaked depends on the code that is compiled. This problem has been resolved by the fix.
Service pack informationTo resolve this problem, obtain the latest service pack for Microsoft Visual Studio .NET. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
837234 List of bugs that are fixed in Visual Studio .NET 2002 Service Pack 1
Hotfix informationThe English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Date Time Version Size File name ----------------------------------------------------------------------- 15-Feb-2003 00:25 5.50.4134.600 6,428,040 Vs70_qfem_q814483_en.exe
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in Visual Studio .NET 2002 Service Pack 1.
Article ID: 814483 - Last Review: 01/07/2015 16:46:25 - Revision: 4.1
Microsoft Visual Studio .NET 2002 Professional Edition, Microsoft Visual Studio for Applications SDK 1.0
- kbnosurvey kbarchive kbqfe kbhotfixserver kbvs2002sp1fix kbvs2002sp1sweep kbbug KB814483