Question

I upgraded a .NET 2.0 Winform Application build with VS2005 to .NET 3.5 SP1. build by VS 2008

The application had a memory leak in .NET 2.0 caused by a ToolStripControl that was referenced by a UserPreferenceChangedEventHandler.

Upgrading to .NET 3.5 fixed the issue. I still have a problem with DataGridViews.

They are also referenced by a UserPreferenceChangedEventHandler.

Are there some common problems with DataGridViews that prevent forms containing them not being recycled by the garbage collector?

Instance Retention Graph

Was it helpful?

Solution

For anything implementing IDisposable you should call Dispose(). DataGridView is one of those... which in turn ensures that it unregisters the static event handler you mention...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top