Hi Iris,
WSL2 runs inside a lightweight virtual machine, so its memory management differs from that of regular Linux processes.
When Linux processes exit, their memory becomes available within the Linux VM, but WSL2 may retain the allocated memory instead of immediately returning it to Windows. This helps improve performance when the memory is needed again.
You can try the following steps:
- Update WSL:
wsl --update - Open
%UserProfile%\.wslconfigand add: - Restart WSL to apply the changes:
wsl --shutdown
Note that wsl --shutdown will stop all running WSL distributions, so save your work first.
You can also check your WSL version using wsl --version to confirm support for this setting.
Best regards,
Harry P.