Memory Profiling in .NET
A .NET project I work with has recently run into issues with the application slowing down machines when the application has been running for days. After a fair amount of head-scratching, it turns out that checking to see if a class that you’re instantiating implements IDisposable (and then disposing it) can be very important. I knew it was important, but it’s also the sort of thing that can easily get overlooked during crunch time on a project. In fact, it’s so crucial that I’m surprised exceptions aren’t thrown when a program ends that hasn’t properly disposed of disposable objects.
To make a long story short, the Icon class in Windows Forms is one of those classes, and we were creating a great deal of Icons instances. It turns out there are more classes than I’d suspected in .NET that need to be disposed of manually.
Scitech’s .Net Memory Profiler made the process of finding all this out much easier. If you’re a .NET developer (and especially if your application is distributed to end users), I highly recommend picking up a copy. At $99 it’s a steal. It’s already saved the project I’m working on several times that, just counting the hours I would have put in tracking all this down manually.