Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
Memory usage increases when you run a Visual Basic 2005 or Visual Basic 2008 application that creates an instance of a class
Article ID: 919481 - View products that this article applies to.
Consider the following scenario:
Note You are more likely to notice this behavior when the following conditions are true:
This issue occurs because the Edit and Continue debugging feature in Visual Studio 2005 or in Visual Studio 2008 maintains a list of weak references to objects that have been created. If the object that has been created is a class that contains an event, these weak references are maintained for the duration of the program. This behavior increases memory usage.
To resolve this issue, use either of the following methods.
Method 1: Restart the Visual Basic applicationYou can restart the Visual Basic application. When you do this, the memory is freed.
Method 2: Compile the Visual Basic application in release modeYou can compile the Visual Basic application in release mode. When you run a Visual Basic application that was compiled in release mode, memory usage does not increase when you create an instance of a class that contains an event.
Steps to reproduce the issue
Article ID: 919481 - Last Review: March 27, 2009 - Revision: 2.0