I can not allocate ram memory for WSL2
0
0
Entering edit mode
13 months ago
ailton • 0

Dear;

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.

WSL2 • 1.5k views
ADD COMMENT
2
Entering edit mode

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 -hm to see the amount of available memory in the Linux shell.

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
1
Entering edit mode

Can you go into the Linux shell and type free -mh and post the output please?

ADD REPLY
0
Entering edit mode

:~$ free -mh

  • Mem: total=7.7Gi used =285Mi free=7.3Gi shared=2.0Mi buff/cache=152Mi available=7.2Gi
  • Swap: total=2.0Gi used =0B 2.0Gi
ADD REPLY
1
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 1628 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6