Please let us know how useful you find this tip by rating it below. Do you have a useful Windows tip, timesaver or workaround to share? Submit it to our monthly tip contest and you could win a prize!
Programmer Vincent Fatica has written a command-line tool called WORKSET.EXE. When supplied with the process ID (PID) of a running program in 32-bit Windows, it forces Windows to minimize the working set, or allocated physical memory, dedicated to that particular process. You can get the PID of a particular process through the Task Manager or through the command-line function TASKLIST (available only in Windows Server 2003 and Windows XP).
WORKSET.EXE's value is twofold. One, it can tell you how aggressive a given application is at staking out system memory. Some applications are more aggressive than others are simply because they are built that way. If you are choosing among several applications and want to pick the most efficient one with memory (perhaps because you're running several instances of it at once on a server), WORKSET.EXE is one way to determine how much of a margin between needed RAM and allocated RAM a given app uses. It can also be used as a way to test one's own custom applications for this kind of bloat, if you're trying to write something that's as conservative as possible about using memory.
Two, you can in theory use it as a way to pre-emptively free up memory from other programs before launching a big application. However, I should point out that WORKSET.EXE is not really intended to be used as a memory optimization tool. Various applications in the past have claimed to compress or optimize memory use when, in fact, all they did was second-guess the way Windows's own memory manager worked, which created more problems than it solved.
A commonly observed behavior of Windows is that applications often seem to spawn huge memory footprints. It's not really a malfunction, but simply a product of the way memory is allocated: If a system has a great deal of available RAM, a running program typically expands its working set size to make use of as much of that memory as possible, so the program doesn't page out needed memory to disk. When another program is launched, the memory manager makes as much room as is needed to deal with the new application.
That said, at the very least, the program shows how some applications may be far more memory-hungry than others -- even when their functionality doesn't really demand it.
Serdar Yegulalp is editor of the Windows Power Users Newsletter. Check it out for the latest advice and musings on the world of Windows network administrators -- and please share your thoughts as well!