Overview #
If your Windows PC runs smoothly after startup but gets slower and slower the longer it stays on, you may be facing a memory leak.
Memory leaks happen when programs fail to release RAM after use — over time, your system runs out of available memory, forcing it to use the page file and slowing everything down.
Let’s fix it together by identifying which process is leaking, cleaning up unnecessary services, and optimizing how Windows manages memory.
Terms & Definitions #
Term | Definition |
---|---|
Memory Leak | A software issue where RAM used by a program isn’t released back to the system, even when it’s no longer needed. |
Commit Charge | The total amount of virtual memory (RAM + paging file) currently in use. |
Working Set | The actual physical memory a process is using at a given time. |
Page File | A reserved portion of disk space that Windows uses as “virtual RAM” when physical memory is full. |
Non-paged Pool | A section of memory that must stay resident in RAM — high growth here usually indicates a driver leak. |
Steps #
1. Check Current Memory Usage #
Let’s identify how memory is being used and whether it’s growing abnormally.
Steps:
- Press Ctrl + Shift + Esc to open Task Manager.
- Click the Performance tab → Memory.
- Note the In use (Compressed) and Committed values.
- Observe over time — if “In use” or “Committed” keeps climbing even at idle, a leak is likely.
PowerShell Command (Show Top Memory Consumers):
Get-Process | Sort-Object -Descending WS | Select-Object -First 10 Name,Id,WS,PM
“WS” = Working Set (actual RAM used). Keep this list open and re-run after 15–30 minutes to see which process keeps growing.
2. Identify Leaking Processes #
Some apps (especially browsers, drivers, or background utilities) accumulate RAM over time.
Steps:
- In Task Manager → Details tab, click Memory (Private Working Set) to sort.
- Note any processes that climb in usage without decreasing.
- Common culprits include:
- Antivirus (especially outdated or third-party)
- Chrome / Edge extensions
- Audio or printer drivers
- Windows Explorer or ShellExperienceHost
PowerShell: Track Memory Growth Over Time
Get-Process | Sort-Object WS -Descending | Select-Object -First 5 Name,Id,WS
Start-Sleep -Seconds 300
Get-Process | Sort-Object WS -Descending | Select-Object -First 5 Name,Id,WS
Run this twice (5 minutes apart) to spot growth trends.
3. Restart Windows Explorer and Non-Essential Apps #
If leaks appear in user processes (not system), restarting them often releases locked memory.
Commands:
Stop-Process -Name explorer -Force
Start-Process explorer
Then restart browsers and other heavy apps.
4. Inspect Drivers for Kernel-Level Leaks #
If no app is visibly growing, the leak may be in drivers (network, video, or USB).
Steps:
- Press Windows + R, type
perfmon /res
, hit Enter. - Switch to the Memory tab → look at the Non-paged Pool value.
- If it continually increases, it’s likely a driver leak.
Command to View Pool Memory Usage:
Get-Counter '\Memory\Pool Nonpaged Bytes'
Fix:
- Update all device drivers (especially network, audio, and GPU).
- In Device Manager, right-click devices → Update driver.
5. Check Windows Services for Persistent Memory Use #
Some Windows services, like SysMain, Print Spooler, or Windows Update, may leak memory after uptime.
Commands:
Get-Service | Where-Object {$_.Status -eq 'Running'}
Identify non-essential services and try restarting them:
Restart-Service -Name "wuauserv" -Force
Restart-Service -Name "spooler" -Force
Restart-Service -Name "SysMain" -Force
Restarting often clears leaked allocations without rebooting the whole system.
6. Use Resource Monitor to Verify #
Resource Monitor gives a clear breakdown of what’s holding memory.
Steps:
- Press Windows + R, type
resmon
, hit Enter. - Go to Memory tab → sort by Commit (KB).
- Watch “Standby” and “Free” — if both stay low while “In Use” climbs endlessly, you’ve found a leak.
7. Set a Proper Virtual Memory Size #
If Windows runs out of RAM, paging can stabilize the system temporarily.
Steps:
- Press Windows + R, type
sysdm.cpl
. - Go to Advanced → Performance → Settings → Advanced → Virtual Memory.
- Choose System Managed Size.
- Click Set, then OK.
Command:
wmic pagefile list /format:list
8. Run System Maintenance and Cleanup #
Windows includes built-in tools to clear lingering cache and logs that mimic memory leaks.
Commands:
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
cleanmgr /sagerun:1
9. Schedule Automatic Memory Flush (Optional) #
If leaks persist in older systems, you can automate a soft memory refresh.
Create a Scheduled Task with this Command:
Clear-Content "$env:SystemRoot\Temp\*"
Clear-Content "$env:LocalAppData\Temp\*"
Start-Sleep -Seconds 5
Clear-Content "$env:SystemRoot\Prefetch\*"
Schedule it to run daily or weekly — it can delay reboots while keeping things responsive.
Conclusion #
You’ve now checked for both user-level and kernel-level memory leaks, stabilized your system with proper virtual memory, and refreshed caches.
In most cases, these steps stop gradual slowdowns and prevent memory exhaustion.
If the problem reappears after each reboot, focus on:
- Recently installed drivers or software
- Unpatched Windows builds
- Over-aggressive background security software
Updating, disabling, or replacing these often resolves persistent leaks once and for all.