We have a .net c# service that when tured on is chewing up more and more memory. It has one 'Service' derived class that basically creates other objects that encapsulate individual functionality that the service is meant to support. Im thinking that maybe I am creating an object and its not getting garbage collected due to a programming error.
Anyone know the best way to find out what is going on without setting break points?
You need to use memory profiler to see what objects are causing memory leaks. I use this one for such cases: http://www.jetbrains.com/profiler/
Open task manager and watch the memory
Wrap each major piece of execution in a Class (here i used a BLL)
then call from the BLL
Then Try wrapping each top level piece in a using statement one at a time
This makes most everythign deallocate after the code is done, makes for easier memory cleanup.
then re run, if the memory stops going up, or slows down, you've found a cuplrit, go deeper into that one.
If you are happy with the results after you've wrapped all your top level calls with using statements, you might be done before you dig deeper. (Though you should dig, just to learn what's really wrong when you're not in a hurry)
best way is to run Performance Profiler that comes in Visual Studio. It allows you to see your object lifetime.
This link might be helpful
Use the CLR Profiler. It's a profiler specifically for examining memory usage.
1.1 Profiler
2.0 Profiler
4.0 Profiler
You must be using objects that need to be disposed.
Some good examples are streams and web clients.
You can use memory profilers like memprofiler, ants profiler, and this question can also help What Are Some Good .NET Profilers?
They give you a good look at the objects being created, generation they are in, memory they are using etc. You can, most of the times, narrow down the problem using profilers.