I want to increase allocated RAM for WSL. I have created in my root /users/ .wslconfig. How does it looks:
[wsl2]
memory=6GB
swap=0
localhostForwarding=true
I did wsl --shutdown and then started WSL to apply changes.
But I don't know how to check if allocated RAM is changed. How do I check it?
One way you can check is from inside the WSL2 environment with standard Linux commands. See which WSL environments you have by running this in Powershell: wslconfig /list and if you have WSL2 properly configured, you can access the shell with wsl also in Powershell.
$ free -mh
total used free shared buff/cache available
Mem: 7.8Gi 552Mi 5.9Gi 400Mi 1.3Gi 6.6Gi
Swap: 2.0Gi 0B 2.0Gi
I have 16GB RAM on my machine and my wsl2 config is this:
[wsl2]
memory=8GB # Limits VM memory in WSL 2 to 8 GB
There are a handful of other commands you could use too, including:
# print memory usage statistics
$ vmstat -s
# print top processes with memory information
$ top
# fancy top
$ htop
In Docker Desktop CLI you can type cat /proc/meminfo to check Docker memory usage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With