« Whack A Developer | Main | Trimming the Fat »

September 27, 2004

Leaky Objects

We're in the midst of developing an ASP.NET v2.0 application for one of my clients. Lately, our application has been becoming a bit unstable. We originally attributed the issue to the fact that we are using beta software (hey, what do you expect?). Upon further examination, though, we discovered that we had forgotten to close a SqlDataReader object that is used to populate an object collection that is used quite frequently in the application. So, basically, we were draining the connection pool, which then tanked the application. Just goes to show you how forgetting a single line of code can cause major problems (even in the protected world of .NET).

11:04 PM | Permalink


I've had a similar experience. Compounded when used within the context of clustering (what happens to the connection pool during/after failover?)

What I've figured is that this is really an issue of design/architecture (rather than just coding). Because the SqlDataReader object is s easy to use directly doesn't mean that you just go ahead and use it.

If you are going to use it, rather use it using 'using' and take advantage of its implementation of the IDisposable interface... hmmm maybe that is just coding?

Posted by: Alan | Sep 29, 2004 7:38:13 AM

The comments to this entry are closed.