Ask the Expert

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: