Three things you can do about Windows memory pressure. One of them helps, and this README tells you which.
Search for a Windows RAM cleaner and you get a hundred tools that make a number go up and your machine go slower. The techniques are real — these scripts use the same Windows internals the paid ones do — but almost nobody explains what they cost.
So: what each one actually does, and when it is worth doing.
powershell -ExecutionPolicy Bypass -File .\Clear-Memory.ps1 -ReportBEFORE : 4.21 GB free of 15.85 GB (73.4% used)
Application MB Processes
----------- -- ---------
chrome 3184 27
Code 921 9
...
Most "I need a RAM cleaner" moments turn out to be one application, and the answer is to close that application rather than to run anything.
An application that never starts uses no memory, no CPU and no disk. There is no trade-off, and the effect lasts.
powershell -ExecutionPolicy Bypass -File .\Disable-StartupApps.ps1 -List # see what is there
powershell -ExecutionPolicy Bypass -File .\Disable-StartupApps.ps1 -WhatIf # see what would change
powershell -ExecutionPolicy Bypass -File .\Disable-StartupApps.ps1Nothing is deleted: the HKCU Run key is exported to a .reg file before every change,
and -Restore puts it back. Only the per-user Run key is touched — services, scheduled
tasks and the machine-wide key are left alone, because those are likelier to matter and
harder to undo.
EmptyWorkingSet pushes a process's pages out to the pagefile. Free RAM goes up
immediately. Then the process touches those pages again and they come back from disk,
which is slower than leaving them alone would have been.
It is genuinely useful in one situation: a process has finished a memory-heavy job and is now idle, holding a working set it will not touch again. Trimming that is free. Trimming everything, which is what every RAM cleaner does and what this script does by default, mostly moves the cost somewhere you will not connect to having run it.
The standby list is not wasted memory. It is file cache: pages Windows kept because reading them again from RAM beats reading them from disk. Windows already gives it up instantly when an application asks for memory.
Purging it makes "free memory" jump, and the next few minutes of work slower while the cache refills from disk.
The one real use: before launching something that needs a large contiguous allocation, or after a huge file operation has filled the standby list with data you will not touch again. That is a narrow case, and it is not "my machine feels slow".
# Both 2 and 3. Run elevated for the standby list purge.
powershell -ExecutionPolicy Bypass -File .\Clear-Memory.ps1powershell -ExecutionPolicy Bypass -File .\Clear-Memory.ps1 -CloseApps -WhatIfForce-closes what you list in apps.json. This loses unsaved work — it is
Stop-Process -Force, not a polite request — so it supports -WhatIf and prompts before
each application. Never put an editor, a browser you keep tabs in, or anything you type
into on that list.
cp apps.example.json apps.jsonapps.json is gitignored, because the list is specific to your machine:
{
"close": ["steam", "steamwebhelper", "Spotify", "Discord"],
"protect": ["Code", "explorer", "dwm", "pwsh", "powershell"],
"startup": ["Steam", "EpicGamesLauncher", "Discord"]
}close— process names for-CloseApps. Process names, no.exe.protect— never closed even if listed inclose. A backstop, not a substitute for keeping the list sensible.startup— registry value names in the Run key, which are often not the application's name. RunDisable-StartupApps.ps1 -Listto get the real ones.
- Close the application at the top of
-Report. Usually a browser. - Disable startup applications you launch manually anyway.
- Buy more RAM. Unsatisfying, and still the correct answer for most people running out of it every day.
- Everything else in this repository.
If Windows is paging heavily with nothing obviously large running, the problem is a leak or a genuine shortage, and neither is fixed by moving pages around.
Windows 10/11, PowerShell 5.1 (built in). The standby list purge needs an elevated shell; everything else does not.
These started as scripts on my own machine and the honest framing above is most of the value. Feedback and bug reports are welcome — I am still working on this. Especially:
- Measurements that contradict what this README claims. If trimming demonstrably helped on your workload, I would like the numbers, and the README should say so.
- A
NtSetSystemInformationreturn code you hit that is not handled. - Startup entries in places this does not look at, where moving the check would be safe.
Open an issue for any of it.
MIT — see LICENSE. These scripts trim working sets, purge kernel memory lists and force-close processes. Read them before running them.
🇹🇷 Türkçe: README.tr.md