Spotting GDI Leaks with Task Manager
After reading KC's post
about finding GDI leaks with the Windows Task Manager back in June, I've added GDI columns to my task manager view on all the computers I personally use. It's often a good problem indicator when my machine's really slow but the CPU and memory utilization isn't out of hand. RSS Bandit
, my aggregator of choice, occasionally gets a little greedy with the GDI resources. Most apps seem to use a most a few hundred, but RSS Bandit occasionally shoots to over 4,000,000,000 (4 billion). That seems slightly excessive, so I restart it and everything's fine.
It's also indicated a GDI leak in a Reflector Addin I was testing.
Here's how to add the GDI Objects column to your Task Manager:
1. Bring up the Task Manager (Ctrl - Alt - Del works)
2. From the View menu, pick "Select Columns..."
3. Check GDI Objects and hit okay
By the way, this points out that it's still very possible to have resource leaks in Microsoft.NET apps. The .NET garbage collector will clean up your memory after you, but it doesn't watch resources. You have to make sure you're disposing your unmanaged resources.
 I'm not talking about RSS Bandit here, it's just a general statement. Often apps use components or call .NET code that just wraps unmanaged win32 code. I subscribe to almost 1000 feeds so maybe RSS Bandit is just telling me I need to cut back a bit and get another hobby.