July 26, 2008: Windows Memory Management

Unless you’ve studied it a bit, you probably have a few wrong impressions about how Windows memory management works, and that may be hurting your understanding of how to get good performance from the OS. So here are a few links that are worth reading. On this topic, there seems to be a lot of just plain wrong advice out there on the web. So here are a few links which avoid those common misconceptions:

ATM running on my Vista laptop

The above picture is of Tmurgent’s ATM tool, very handy on Vista/W2008 (though it also works on earlier versions of the OS). I added a bit of text to the above screenshot of the tool running on my own system (2GB of RAM installed).

OK, you’re saying, that’s fine and dandy, but you don’t want to deal with a lot of mumbo jumbo. You just want to know if your system is using memory optimally! OK, here’s how to check. Open Perfmon (it’s part of Windows), remove all the default counters it is graphing, and add this one counter: Memory, Page Reads/sec. You’ll get a graph like the one below:

Perfmon (on my Vista laptop) showing pretty good pagefile performance.

Your goal is to make that line as flat and low as possible while you are using your system normally. That’s the number of times Windows has to fetch data out of the pagefile on disk and stick it back into RAM. You’ll probably never get it to the point where it stays perfectly flat at zero, but you do want it to return to zero much of the time, with only occasional  spikes, and those spikes should usually be to 10 or less. Note that in this example, I set the multiplier scale to 10, so that spike to ‘60’ on the graph was really only a value of 6 page reads per second. This is a system that’s responsive and very rarely goes to disk to retreive data that should be in RAM.

If you’re seeing too many page reads, you have two basic choices: 1) buy more RAM, or  2) run less memory intensive processes. Choice #2 can mean a lot of things. It may mean just closing programs you are not using, or it may mean looking around for one or two programs which seem to hog a lot of RAM.

Tweaking your page file isn’t going to do anything to make this graph look better, and in many cases will make it a lot worse. Unless you really really understand this stuff and are in fairly unusual circumstances, tweaking the pagefile or other OS parameters is not going to be a winning strategy. Don’t say I didn’t warn you!

Comments (View)
blog comments powered by Disqus