Friday, January 14, 2011

Windows 7 is eating up all my memory!

In response to a question I had once apon a time (when Vista first came out), and have recently seen posted ... "Where did all my free memory go?"

Does a process have  a memory leak?  The memory usage may not be a leak at all.  It could just be the OS caching to memory (a good thing).  Since Windows Vista, Windows has managed its memory a bit differently.  Windows tries to think more intelligibly with regard to the type of work that you typically do with your computer.  It caches information in memory, ready for your use.  It might preload certain information such as program you use frequently, or documents, or other information to have it ready at your fingertips.  This is called SuperFetch and there are a couple of decent articles on this that I found with a quick search:

This actually speeds up performance of the machine significanly.  It keeps track of what memory it can free up for the applications that you are running as well, releasing the cache as necessary.

Task Manager

This appears in the Cached section of the Windows Task Manager.  You can also look at the Resource Monitor (see image)  and look at the memory tab in there to see a graph of In Use, Standby (essentially cache), and unused memory.  If any program needs more memory than is currently free, the operating system releases it appropriately from the Standby memery - all transparent and unnoticed by the user.

Resource Monitor

This doesn't necessarily mean that you don't have a memory leak, but you may need to look at more than just total memory in use.  If you really do have a leak and your In Use is max'd (resource monitor) or Available shows near 0 (task manager), you can take a look at the individual process memory usage as seen in task manager, or in the Resource Monitor mentioned (memory tab).

One thing that I've found useful is to also look at the Disk tab in the Resource Monitor, as sometimes a program is hitting the disk so hard that it becomes a bottleneck to the whole machine.  On that tab, blue represents the percentage of active time.  You can sort by Total (B/sec) and then see what processes are hitting the hard drive for information the most, and that might help you track things down a bit as well.

It appears that MS antimalware software (I use Microsoft Security Essentials) is working double time at the moment

I hope that helps.