Garbage collection issues in .NET
Are there any known issues with garbage collection in .NET? I have a C# Web forms application that sometimes stops responding for no apparent reason, and I suspect garbage collection may play a role here. Thoughts?
No, to my knowledge there are no problems with the .NET garbage collector. However, that doesn't mean you are not experiencing problems with object disposal because of misuse. Having said that, the honest truth is you're much more likely to find the source of your problem in your own code. I would try to carefully pinpoint the methods/classes that are involved with your lockups, and then try to understand how they relate to each other when the objects are invalid (i.e., after they have been disposed). The chances are much higher that you simply have a logic bomb over the chances that the .NET garbage collector is simply "locking up." You need to carefully review the code in your Dispose methods if you have modified them, as well as any cleanup methods that you would call as you try and close things down, whether they be Form classes or other classes. Take your time, insert some breakpoints, and begin debugging your code with an open mind.
This was first published in February 2005