Why doesn't WSL2 release allocated memory once Linux processes are done?

Iris Smith 20 Reputation points
2026-11-24T01:54:18.2333333+00:00

Why doesn't WSL2 release allocated memory once Linux processes are done?

Windows for business | Windows 365 Enterprise
0 comments No comments

Answer accepted by question author
Harry Phan 37,560 Reputation points Independent Advisor
2026-11-24T02:27:19.3033333+00:00

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:

  1. Update WSL: wsl --update
  2. Open %UserProfile%\.wslconfig and add:
  3. 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.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.