I recently bought a new desktop, and one of the first things I did was install a ton of games! After that, I wanted to get some work done and installed WSL 2. As on my laptop, the memory usage can be pretty high.
To optimize the memory usage of WSL2, you can use the following configuration file:
%UserProfile%.wslconfig and enter the following content (feel free to edit the memory setting. I set it to 2 GB):
Then restart the WSL service using the following command in an elevated PowerShell window:
Get-Service LxssManager | Restart-Service
And you should see that the memory usage is drastically reduced:
And that’s how you can reduce the memory consumption of WSL 2.