If the vmem (or the process associated with WSL’s memory management) is consuming 100% of your CPU, and this freezes or crashes your system, it’s likely that WSL is using too many resources or has a memory leak.
You have a series of practical solutions to apply:
You can restrict the resources that WSL can use. To do this, create (or edit) the file:
%UserProfile%\.wslconfig
You can add something like this:
[wsl2] memory=4GB # RAM limit processors=2 # CPU limit
This prevents WSL from consuming all the RAM or CPU of your system. Requires restarting WSL.
Restart WSL with:
wsl --shutdown
2. Check which process within WSL is consuming CPU
Iniate WSL and use:
top
or
htop
Search for the process that consumes most CPU (could be something like node, python, etc.). If you identify the culprit, you can optimize it, kill it, or reconfigure it.
Docker Desktop with WSL2 may use a lot of memory. Check:
Docker Desktop > Settings > Resources
And limit RAM and CPU from there if you have containers running.
Evaluate:
wsl --update
And make sure Windows 10/11 is updated.
Sometimes unnecessary demons are executed when starting WSL. Check your .bashrc, .zshrc, or services in /etc.
If you have a swap file in WSL and it’s not limited, you can generate excessive disk/CPU usage.
Check this in .wslconfig:
swap=2GB swapFile=C:\\wsl-swap.vhdx
7. Monitor with Event Viewer (Event Viewer)
In case of severe crashes, open the Event Viewer (eventvwr.msc) and review errors under:
Windows Logs > System or Application
Look for critical errors related to vmem, WSL, or wslhost.exe.
You can also:
wsl --set-version <distro> 1
