Skip to content

FIX · MEMORY

Vmmem using too much memory: stop it now, or cap it for good

Vmmem at the top of Task Manager is not a virus and not a leak in Windows. Microsoft describes it as the process responsible for the virtual machine that powers WSL 2, so its memory is whatever your Linux tools and containers are holding. You can release that memory with one command, and set a ceiling so it does not come back.

Updated .

TECHNICAL SUMMARY

What it isThe virtual machine that powers WSL 2
Default memory limit50% of the memory on Windows
Stop it nowwsl --shutdown (closes every distribution)
Cap itmemory= under [wsl2] in %UserProfile%\.wslconfig
PC Tweaker planNo control for WSL; the commands are free

What Vmmem is

WSL 2 runs Linux in a lightweight virtual machine, and Microsoft's WSL team measures its memory use by watching the Vmmem process. It has no window of its own, and anything that runs on WSL 2 makes it grow, including Docker Desktop when it uses the WSL 2 backend and any compiler, database or container inside a distribution.

Why it holds so much

Without a setting, WSL 2 may use up to 50% of the memory on Windows, and up to 25% more as swap. Linux also uses spare memory as file cache, so a large build can leave a large Vmmem behind it. Microsoft added automatic reclaim for this: the autoMemoryReclaim setting defaults to dropCache, which releases cached memory right away, and gradual releases it slowly. When Linux frees memory, Vmmem shrinks and Windows can use that memory again.

It should stop by itself

By default a distribution with nothing running shuts down after 15 seconds, and on Windows 11 the virtual machine follows after 60 seconds idle. If Vmmem stays after you closed every terminal, something is still running. Check with wsl --list --running, and look for Docker Desktop or an editor connected to WSL.

If you do not use WSL

The Microsoft documentation we checked ties Vmmem to WSL 2. If wsl --list --running reports no running distributions and Vmmem is still there, look at other virtual machine software on the PC before assuming a fault.

Do it by hand

  1. See what is running

    This lists only the distributions that are running right now.

    wsl --list --running
    PowerShell
  2. Release the memory now

    This stops every running distribution, so save your work inside them first. To stop only one, use wsl --terminate followed by its name.

    wsl --shutdown
    PowerShell
  3. Set a ceiling

    Put these lines in a file called .wslconfig in your user folder (C:\Users\<you>\.wslconfig). It does not exist until you create it, and it must not end in .txt. Choose your own size, such as 8GB. Microsoft recommends the WSL Settings app in the Start menu as the alternative to editing the file.

    [wsl2]
    memory=4GB
  4. Apply it

    The setting is read when the virtual machine starts. Allow about 8 seconds after shutdown before you open a distribution again.

    wsl --shutdown
    PowerShell
  5. Undo it

    Delete the memory line or the whole file, then run wsl --shutdown. WSL returns to its default limit.

With PC Tweaker

PC Tweaker has no control for WSL, so use the commands above. Its Smart RAM booster does a different job: it releases Windows' standby memory cache and does not touch the memory that the WSL 2 virtual machine holds.

Rather not edit the registry by hand?

PC Tweaker shows the exact change before it runs, records the value it replaces and puts it back with Restore. The Free plan needs no account. If a payment fails or a plan ends, Pro tools lock; changes already applied stay as they are and Restore still undoes them.

Common questions

What is Vmmem?

Microsoft describes it as the process responsible for the virtual machine that powers WSL 2.

How do I stop Vmmem?

Run wsl --shutdown. It stops every running WSL distribution, so save your work in them first.

How do I limit how much memory Vmmem uses?

Create .wslconfig in your user folder with memory=4GB, or your own size, under [wsl2], then run wsl --shutdown. Without it the limit is 50% of the memory on Windows.

Why does Vmmem stay after I close WSL?

Something may still be running, such as Docker Desktop or an editor connected to WSL. By default an idle distribution stops after 15 seconds and, on Windows 11, the virtual machine after 60 seconds idle.

Try PC Tweaker

Free download for Windows 10 and Windows 11.