It didn't take long for 8GB to become the norm for desktop PCs (and a fair few notebooks) and soon, 16GB will be the default. Even with these massive amounts of memory, from time to time, you'll find yourself poking around Task Manager, looking for something to close. What you might not realise is that a 2MB application could be taking up gigabytes if it's not cleaning up after itself.
Usually, when I notice I'm running out of memory, I'll fire up Task Manager, locate offending programs and see if there are any "easy wins" — resource-hogging applications I can shut down without issue. Most of the time, Chrome is at fault, so another trip to its Task Manager and closing the Shockwave process almost always provides some breathing room.
Unfortunately, this process was giving me diminishing returns and slowly I found that, no matter what I closed, a good 4GB of my 8GB was occupied by something. A reboot was definitely in order, but I couldn't help but hold off on this brute-force approach without first investigating.
Now, application memory usage in Windows is an interesting topic, because you won't always get an accurate representation of how much a program is using just by looking at Task Manager. Operating systems allocate all kinds of resources to a running application and those resources won't always be calculated into a nice fat figure for you to look at.
That's not to say Task Manager is useless — it'll almost always give you a good idea of what's taking up too much room. But not always.
This turned out to be the case for my memory issues — an application had gone a little crazy accessing resources and as such, had over 300,000 open handles.
At its simplest, a handle allows a program to interact with a resource via the operating system's various APIs. Each one requires a small amount of memory and if you have enough... well, you get the situation you see in the lead image.
The memory usage reported by the program is tiny — a couple of megabytes — which is why I'd never noticed it before. It was only after I activated the handles column that the problem became apparent. Terminating the application started an extremely slow process of memory reclamation. Switching over to the "Performance" tab I was able to watch the Memory gauge gradually descend from 7GB to 3GB — an absolutely insane amount for one application to cling to.
The lesson here is that you should always keep an eye on new programs you decide to use, especially ones that stay resident. In this case it was a service for Synergy, an open-source tool that allows you to use your keyboard and mouse seamlessly between various operating systems. I hadn't actually used Synergy in months, so it was an easy decision to disable the service for good.