Reputation: 193
I created a .wslconfig file following the first answer here to limit wsl resource consumption on my Win10 os. It does not work and I have no clue why. I am using Docker Desktop. File:
# Limit the wsl or vmmem consumption of resources
[wsl2]
memory=3GB # Limits VM memory in WSL 2 to 3 GB
processors=3 # Makes the WSL 2 VM use 3 virtual processors
localhostForwarding=true # Boolean specifying if ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via localhost:port.
Restart-Service LxssManager
in my admin powershell successfullyC:\Users\PC Paul
which is the main userI am at my wits end, do you have any idea where the problem might be?
Thanks, Paul
Upvotes: 2
Views: 2243
Reputation: 305
In my case I created the .wslconfig file by creating a new file like this:
After saving it the icons displayed was this:
I thought it should work because the name is correct.
But when I open the userprofile folder in command prompt and type in dir
it showed .wslconfig.txt
Solution: Open command prompt, change directory and then rename file manually
cd %userprofile%
rename .wslconfig.txt .wslconfig
Upvotes: 1
Reputation: 1945
In my case, it turns out that the memory parameter is case sensitive. I.e. you have to use GB
, not Gb
. E.g. this works...
[wsl2]
memory=3GB
This doesn't work...
[wsl2]
memory=3Gb
Upvotes: 0
Reputation: 193
Ok it seems like the file has to start with [wsl2]. I deleted the comment at the top and now it seems to work.
Edit: Further help if it doesn't work may be found here: https://superuser.com/questions/1632543/wslconfig-not-applied-for-wsl2
Upvotes: 1