Unhogging RAM from WSL

4 hours ago 1

Home Blog sisig.ai Mailing List RSS feed

23 Oct, 2025

I have 64 gigs of RAM. I thought that was plenty, but recently I've noticed Libre Hardware Monitor reporting that I was consistently at 90% RAM usage.

How?

Opening Task Manager reveals that VmmemWSL.exe was consuming 30GB of RAM -- but when I ran htop inside Ubuntu running on the Windows Subsystem for Linux (WSL), it was only reporting 6GB of use. I also run Docker, but it's reporting only 2GB of use. So where did the rest of the ~22GB go?

It turns out it has something to do with the way WSL's dynamic memory allocation works (hence VmmemWSL.exe), and how it doesn't immediately free up memory from the host OS even that memory is no longer in use by the Linux OS.

The fix was to do:

  1. wsl --shutdown in Powershell to force free the memory
  2. Create $HOME/.wslconfig with the following contents
    [wsl2] memory=16GB swap=0 processors=4
  3. Restart WSL with wsl in Powershell

So now, WSL only ever hogs up to 16GB of idle RAM -- which is still a lot -- but I now have plenty of RAM available again for my Windows host.


Footnotes:

  • Comet was eating 6GB of RAM with only a few tabs open. Chromium, am I right?
  • I wish there was Orbstack for Windows

#ram #windows #wsl

Read Entire Article