Tuesday, March 27, 2012

Easy way to find connection leaks?

I, just like others, am experiencing problems with data leaks. I was wondering if anyone knows of a tool out there that can help pinpoint the pages with problems? I basically want to find the culprits!

Thanks,
--
YonahBack in the old days I usedNumega's BoundsChecker but it's for C++.

In principal with managed code (i.e., C# and VB.Net) you shouldn't have problems with memory leaks, though I'm sure there are ways to generate them.

There may be some tricks you can use to recover memory faster. The articles below may help:

Garbage Collector Basics and Performance Hints

Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework|||::In principal with managed code (i.e., C# and VB.Net) you shouldn't have problems with
::memory leaks.

Interesting statement given that the question is for CONNECTION LEAKS, not memory leaks. The articles are of similar relevance :-(

I, just like others, am experiencing problems with data leaks.

No, not really.

What you can do is get a profiler (there are some good free ones around) that helps you to figur out what objects are in memory and why. If you experience a "forgot to close the connection" issue, though - you are stuck here.

What I do in general (in our O/R mapper) is handle all database connection open/close from one class - so I actually never have this issue, simply because my code is very sure things are easy here. Consider going this appraoch, concentrating this in one location.

Besides this:

You an set for SQL Server an application "name" that shows up in SQL Server's enterprise manager when you look at open connections. You COULD set this name differently for every page (like the page name), then you would know WHERE you forget to close the connection.

No comments:

Post a Comment