How to free up RAM from the command line
Most memory "optimizers" are a pointless waste of time, more likely to slow you down than offer any noticeable performance benefit.
But if you think your PC is using more RAM than it should, then there is one small and very simple tool which might be able to help.
Empty Standby List is a free command line application -- from the developer of Process Hacker -- which provides various ways to free up RAM.
If you’re normally console-phobic, don’t worry, the program accepts only four commands. You can set it up to run from a shortcut or a batch file in a few seconds (just make sure it’s set to run as an administrator).
Here’s the first command.
This tells Windows and your applications to cut memory usage by all user and system processes, and is the technique most commonly used by other memory "optimizers".
It will free up RAM, but you may also find some processes immediately start swapping back data from the paging file, slowing you down overall.
The next command also has risks.
This flushes modified pages to disk, then frees up that RAM. It could generate a lot of disk activity, which may cause problems. But Windows would have carried out those writes anything, so if you’d like to get them out of the way, so they won’t randomly interrupt you later, then it might useful.
If you’d like something safer, this may be better.
Standby pages are RAM which used to belong to a process, but doesn’t any more, and are really being kept "just in case".
This command frees up the lowest priority standby pages, those which Windows thinks are least likely to be needed again. It won’t necessarily recover much memory, but the technique is also very unlikely to have any noticeable performance penalty later.
Finally, if you’re more demanding:
Here Empty Standby List frees up all standby pages, whatever their priority. Some people find it recovers a vast amount of memory with no unwanted side-effects at all, but there are no fixed rules or guarantees: try it and see.
If you’re not exactly sure how your RAM is being used, and so don’t know where to start, check out Sysinternals’ RamMap. It displays a host of facts and figures about your PC’s memory allocation, and -- if you prefer to test your RAM tweaks using a GUI -- also has menu options to free up working sets, standby lists, modified page lists and more.
Empty Standby List is a free application for Windows Vista and later.