Skip to content

Instantly share code, notes, and snippets.

@phamquocbuu
Created January 12, 2021 02:51
Show Gist options
  • Save phamquocbuu/c3c3cdf25598be78b29943cc072613d8 to your computer and use it in GitHub Desktop.
Save phamquocbuu/c3c3cdf25598be78b29943cc072613d8 to your computer and use it in GitHub Desktop.
Create a %UserProfile%\.wslconfig file and use it to limit memory assigned to WSL2 VM. WSL does use a really low amount of RAM but it is allocated about 4GB by default when it is started. If you think that’s too much and would like to decrease it, Windows Insider Build 18945 brough customizable settings for wsl. https://blog.simonpeterdebbarma.c…
[wsl2]
kernel=<path> # An absolute Windows path to a custom Linux kernel.
memory=<size> # How much memory to assign to the WSL2 VM.
processors=<number> # How many processors to assign to the WSL2 VM.
swap=<size> # How much swap space to add to the WSL2 VM. 0 for no swap file.
swapFile=<path> # An absolute Windows path to the swap vhd.
localhostForwarding=<bool> # Boolean specifying if ports bound to wildcard or localhost in the WSL2 VM should be connectable from the host via localhost:port (default true).
# <path> entries must be absolute Windows paths with escaped backslashes, for example C:\\Users\\Ben\\kernel
# <size> entries must be size followed by unit, for example 8GB or 512MB
# %UserProfile%\.wslconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment