Workaround: Create a %UserProfile%\.wslconfig file in Windows and use it to limit memory assigned to WSL2 VM.
Example
[wsl2]
memory=6GB
swap=0
localhostForwarding=true
This will still consume the entire 6GBs regardless of Linux memory usage, but at least it'll stop growing more than that.
Supported settings are documented here.
Comments