Entering edit mode
12 weeks ago
ailton • 0
I can't allocate ram memory to my wsl2, I've already made the recommendations that are available on the site (Advanced settings configuration in WSL | Microsoft Learn), in which I created a .wslconfig file in the path C:\Users\<UserName>.wslconfig . With the following specifications;
Settings apply across all Linux distros running on WSL 2:
[wsl2] #Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB memory=12GB #Sets amount of swap storage space to 8GB, default is 25% of available RAM swap=2GB
And even so I can't increase the amount of ram used by wsl2. In this case, he is using only 7gb of ram, and I would like him to use 12gb.
My notebook has 16gb of ram.
This is actually off-topic and more suited for StackOverflow or WSL GitHub. Anyway, that looks correct. Be sure to restart the WSL after saving that file and then use
free -hmto see the amount of available memory in the Linux shell.
I don't know how much RAM windows needs now-a-days but you may not be able to use 12G since that would leave just 4 GB for windows. Perhaps that is being reflected by 7 GB you are able to use.
Thank you so much for your answer. In this case, he is using only 7gb of ram, and I would like him to use 12gb. I've also tried to download the amount of ram used by wsl2, but it doesn't change. In other words, I used the command memory=4GB, and even so, he continued using 7gb.
Can you go into the Linux shell and type
free -mhand post the output please?
:~$ free -mh
I have no config file, and I seem to be able to use as much RAM as I have free on WSL. Note that it could be that on a 16GB notebook, you only have 7GB free for WSL to use.