Wsl2 release memory

In this article let’s discuss about Wsl2 release memory. Let’s go through the following methods without any delay.

Method 1:

STEP 1
alias drop_cache="sudo sh -c \"echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'\""
STEP 2
source ~/.bashrc
STEP 3
drop_cache

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar by have a try!

Method 2 :

[wsl2]
# https://docs.microsoft.com/en-us/windows/wsl/wsl-config (Docs)
# https://github.com/microsoft/WSL/issues/4166 (Topic)
memory=4GB
swap=16GB
localhostForwarding=true

Hope the above solution works.

Realted Posts : Dbeaver see real password