-
Notifications
You must be signed in to change notification settings - Fork 1
Limiting WSL 2 RAM And CPU
Jason Lewis edited this page Oct 4, 2020
·
4 revisions
- At the root of your C: drive (or whatever drive Windows boots from) add a .wslconfig file.
- Edit the file to contain the following (setting whatever RAM and CPU limits you want):
[wsl2] memory=4GB # Limits VM memory in WSL 2 to 4 GB processors=2 # Makes the WSL 2 VM use two virtual processors
- Restart WSL from an admin PowerShell with the command:
NOTE: If running Docker, you will likely get an error asking to restart Docker.
Restart-Service LxssManager
https://medium.com/@lewwybogus/how-to-stop-wsl2-from-hogging-all-your-ram-with-docker-d7846b9c5b37