Windows Subsystem for Linux can be optimized and tuned using a configuration file located at C:\Users\
The configuration changes which modify your
.wslconfig file will apply to ALL WSL 2 distributions.
Limiting CPU and memory usage¶
For users who want to replicate Finch's
cpu can instead use similar options in their
.wslconfig file, like so:
# Limits VM memory to use no more than 4 GB.
# This can be set as whole numbers using GB or MB
# Sets the VM to use two virtual processors
Reclaiming memory automatically¶
In addition to setting max memory limits, user's can also specify to clean up WSL cached memory automatically. With this setting unset, cached memory remains allocated by the WSL 2 VM until shutdown.
# Automatically releases cached memory after detecting idle CPU usage.
# Set to gradual for slow release, and dropcache for instant
# release of cached memory.