circuittimes.com
Subscribe
How-to

Fix vmmem High Memory in WSL2

Why vmmem uses so much RAM in WSL2 and how to fix it with .wslconfig memory limits, autoMemoryReclaim, swap and wsl --shutdown, step by step.

Rafael Ondrejka

11 min read

Illustration of a gauge with a terminal window and a memory module

Tap a step number as you finish it.

The vmmem process in Task Manager represents the virtual machine that runs WSL 2. A high number there usually means that machine has claimed a lot of your RAM.

The fix is to cap it, let it give memory back, and restart it.

This guide follows Microsoft's WSL documentation, Microsoft's release notes and public GitHub reports, checked on October 21, 2026. It contains no benchmark numbers, and it shows you how to measure your own.

The short answer

Make a file called .wslconfig in your Windows user folder. Under a [wsl2] heading, set memory to a limit you can live with, then run wsl –shutdown in PowerShell and start WSL again.

Microsoft says the default limit is 50 percent of your Windows memory, so on a 32 GB PC the virtual machine can grow to 16 GB. A lower limit is the single most direct fix.

Good to know

Microsoft's pages do not explain vmmem itself. The explanation here comes from public developer reports, and it is labelled that way below.

What vmmem is, and why you may see VmmemWSL

Microsoft documents that WSL 2 runs distributions inside a lightweight utility virtual machine. Its basic commands page says wsl –shutdown terminates all running distributions and that machine.

Developer write-ups describe vmmem as the Windows process that represents the memory and processor use of that virtual machine. Microsoft's WSL pages we read do not use the name.

Newer builds can show it as VmmemWSL. A recent GitHub issue reports watching the VmmemWSL process in Task Manager, so look for either name.

Is vmmem a virus?

Microsoft's pages do not address this. vmmem is commonly associated with virtualization workloads such as WSL 2, so it is expected if you use WSL or Docker Desktop.

If it appears unexpectedly, check which virtualization tools are enabled and run a security scan. A clean scan is not proof of safety, so also check what started the virtual machine.

Why vmmem memory is high

Default ceiling

Microsoft says a WSL 2 virtual machine can use 50 percent of your total Windows memory unless you set memory yourself. Older guides and issue threads quote 80 percent, from earlier documentation.

Cached memory

Linux keeps files it has read in memory. Microsoft added automatic memory reclaim to shrink the virtual machine by reclaiming that cached memory.

Your workload

Public reports tie large vmmem numbers to Docker containers, big builds and model servers. These are community reports, not Microsoft guidance.

Time

Memory can stay claimed after you close a terminal, because the virtual machine keeps running until it goes idle or you shut it down.

Windows memory versus Linux memory

The vmmem figure in Task Manager and the numbers from free -h inside Linux measure different things, so they will not match.

Task Manager

Shows the memory Windows has given the virtual machine process.

free -h

The Linux man page says free shows total, used and free physical and swap memory, plus the buffers and caches used by the kernel.

buff/cache

The man page describes it as the sum of buffers and cache.

available

The man page describes it as an estimate of memory available to start new applications without swapping.

Cached memory inside Linux can be large and reclaimable, while Windows may still count it as given to the virtual machine. Microsoft's reclaim feature releases cached memory back to the Windows host.

Compare Windows-reported memory across identical runs, and use free -h to understand how Linux is using it.

The settings that affect vmmem at a glance

SettingDefault (Microsoft's reference)Effect on vmmem
memory50% of Windows memorySets the ceiling for the virtual machine.
processorsSame as Windows logical processorsLimits how many processors it can use.
swap25% of memory, rounded up to the nearest GBSets disk-based overflow space; 0 means none.
autoMemoryReclaimdropCache, under [experimental]Returns cached memory to Windows.
vmIdleTimeout60000 millisecondsSets how long the machine idles before it stops. Needs Windows 11.
instanceIdleTimeout15000 milliseconds, in [general]Sets how long a distribution idles before it stops.

Every setting here belongs in .wslconfig, which Microsoft says is available for WSL 2 distributions on Windows build 19041 and later.

Defaults in this table come from Microsoft's reference, which was last updated on October 16, 2026.

Fix 1: set a memory limit

  1. Press the Windows key and type %UserProfile%, then open the folder.
  2. Create a text file named .wslconfig. Make sure it does not end in .txt.
  3. Add [wsl2] on the first line, then memory=8GB on the next, using a value that suits your PC.
  4. Open PowerShell and run wsl –shutdown.
  5. Wait for the virtual machine to stop, which Microsoft says typically takes about eight seconds, then start your distribution again.

Did these steps work for you?

Microsoft says size values default to bytes, so add a unit such as 8GB or 512MB. The default limit is 50 percent of Windows memory.

Microsoft also recommends changing these settings in the WSL Settings app, which you can find in the Start menu, instead of editing the file by hand.

Watch out

A limit below what your workload needs can cause slowdowns or out-of-memory failures inside Linux. That caution is ours, not Microsoft's. Raise the limit if builds start failing.

The eight-second rule

Microsoft says changes appear only after the WSL virtual machine has fully stopped and restarted, which typically takes about eight seconds after you close every distribution shell.

To check, run wsl –list –running. If it reports no running distributions, you can start again. Microsoft describes wsl –shutdown as the fast way to restart the machine, and warns it stops everything.

That is a typical wait, not a guarantee. Check with wsl –list –running instead of timing it.

Fix 2: limit processors and swap

Processors

Microsoft says the default is the same number of logical processors as Windows. Set processors to a smaller number if vmmem drives your CPU to the limit.

Swap

Microsoft says the default is 25 percent of the memory size, rounded up to the nearest GB. Set swap=0 for no swap file.

Swap file location

The swapFile setting takes an absolute Windows path, and Microsoft's default is a swap.vhdx file in your Temp folder.

Swap is disk-based memory that is used when demand exceeds the limit. Microsoft says path values must use escaped backslashes, such as C:\\Temp\\wsl-swap.vhdx.

Watch out

Microsoft's release notes say version 2.4.8 fixed a logic error that made wsl2.processors always default to the maximum. If a processors limit seems ignored on an older release, update WSL.

Fix 3: let WSL give cached memory back

Microsoft's September 2023 announcement describes autoMemoryReclaim as a setting that shrinks the virtual machine as you use it, by reclaiming cached memory. It works through a Linux cgroup feature.

With the gradual value, Microsoft says WSL starts after five minutes of low CPU use. It reclaims a fixed share each minute, sized so a full cache would reach zero after 30 minutes.

disabled

Automatic reclamation is off.

gradual

Cached memory is reclaimed slowly and automatically.

dropCache

Cached memory is reclaimed immediately. Microsoft's current reference lists this as the default.

Microsoft's reference lists the setting under [experimental]. To choose a value, add [experimental] and autoMemoryReclaim=gradual to .wslconfig, then restart WSL.

Defaults have moved over time, and some older posts say the setting was off by default. Run wsl –version to see which WSL release you have, and read the reference for your version.

Microsoft's release notes list gradual, dropcache and disabled from version 2.0.0, released in September 2023.

A complete example file

This example puts the settings from this guide in one file. It is an example, not a universal recommendation. Choose values that suit your own RAM, processors and workload.

[wsl2]
memory=8GB
processors=4

[experimental]
autoMemoryReclaim=gradual

Save it as %UserProfile%\.wslconfig, run wsl –shutdown, then check that your WSL release supports each option. Microsoft's reference lists autoMemoryReclaim under [experimental].

Fix 4: idle timeouts

vmIdleTimeout

Microsoft says it is the number of milliseconds the virtual machine sits idle before it is shut down. The default is 60000, which is one minute, and it is available only on Windows 11.

instanceIdleTimeout

In the [general] section, it sets how long a distribution is idle before it is shut down. The default is 15000 milliseconds, and -1 disables it. Microsoft's release notes say it was introduced in 2.5.4.

These do not reduce memory while WSL is busy. They control when the virtual machine stops, which is what finally clears vmmem.

Check and update your WSL version first

Some settings depend on your WSL release, and Microsoft documents a few commands that show it.

  1. Run wsl –version to list the WSL version and its components.
  2. Run wsl –status to see your default distribution, its type and the kernel version.
  3. Run wsl –update to move to the latest version.

Did these steps work for you?

Microsoft says an unrecognized wsl –version command probably means an older inbox version, which you must update first. After updating, run wsl –shutdown so the new version starts cleanly.

At the time of writing, the newest release on Microsoft's releases page is 3.0.4, a pre-release published October 20, 2026. The latest stable release is 3.0.3.

Which Windows versions can use these fixes

Microsoft marks some settings as Windows 11 only. vmIdleTimeout is one of them, along with the newer networking settings explained in our .wslconfig reference.

The memory, processors and swap settings need Windows build 19041 or later for WSL 2. If a setting seems ignored, check your Windows version before you change anything else.

Fix 5: shut WSL down properly

  1. Open PowerShell.
  2. Run wsl –list –running to see what is active.
  3. Run wsl –shutdown to stop all distributions and the virtual machine.
  4. Check Task Manager. The vmmem process should disappear after the machine stops.

Did these steps work for you?

For a single distribution, Microsoft documents wsl –terminate followed by the distribution name. That stops one distribution without shutting down the others.

Docker Desktop and vmmem

Docker Desktop on WSL 2 runs inside the same virtual machine. A developer write-up quotes Docker Desktop's Resources screen as saying that resource limits are managed by Windows through a .wslconfig file.

Two long-running public threads show why people look here. One is a Microsoft WSL issue on memory growth with Docker.

The other is a Docker for Windows issue about vmmem using memory with no containers running. Both are user reports, and some date from 2020 to 2022.

Our view: set memory and processors in .wslconfig first, then restart Docker Desktop. Then check whether the problem remains before you try anything else.

How to measure your own results

We did not benchmark WSL for this guide, and numbers differ between PCs. This method lets you produce your own before and after figures.

  1. Open Task Manager, go to the Details tab, and find vmmem or VmmemWSL. Note its memory value.
  2. Run the same workload you normally run, such as a build or container start, and note the peak.
  3. Change .wslconfig, run wsl –shutdown, wait roughly eight seconds, then start WSL again.
  4. Run the same workload again and record the same two values.
  5. Run free -h inside Linux to see how much memory is used and how much is cached.

Did these steps work for you?

Keep the workload identical between runs, and note your WSL version from wsl –version. That is what makes the comparison fair.

If vmmem stays high: what to check

SymptomLikely causeWhat to try
vmmem stays after you close the terminalThe virtual machine is still running or idleRun wsl –list –running, then wsl –shutdown
Limits do not seem to applyThe virtual machine did not fully restartWait about eight seconds after closing every shell, or run wsl –shutdown
Setting has no effectWrong file name or sectionCheck the file is named .wslconfig and the keys sit under [wsl2]
Memory climbs during buildsWorkload plus cached memorySet memory, consider autoMemoryReclaim, then rerun
CPU stays highToo many processors assignedLower processors and restart

Does limiting WSL memory hurt performance?

Microsoft's pages give no performance answer. A lower ceiling leaves more RAM for Windows, and a limit set too low can starve your workload.

A practical route is to begin with a limit close to your workload's peak, then adjust. The measuring method above shows what that peak is.

What Microsoft's pages do not say

What vmmem is

The WSL documentation we read does not describe the process by name.

Performance cost

Microsoft gives no figures for the effect of a memory limit.

Memory leaks

Public threads describe growth with Docker, and the documentation does not address those reports.

Your exact defaults

They change between WSL releases, so check the reference for your version.

Frequently asked questions

Can I stop vmmem from Task Manager?

You can, but it stops the virtual machine abruptly, and unsaved work inside Linux may be lost. Microsoft documents wsl –shutdown as the supported way to stop it.

Why does vmmem stay high after I close my terminal?

The virtual machine keeps running until it is idle long enough or you shut it down. Run wsl –shutdown to stop it straight away.

How do vmmem and VmmemWSL differ?

They appear to be the same role under different names in different builds. Public reports show VmmemWSL in recent releases.

What is a good memory limit?

That depends on your workload and how much RAM you have. Start near your measured peak, leave enough for Windows, and raise it if builds fail.

Do these settings work on WSL 1?

No. Microsoft says .wslconfig settings affect only WSL 2 distributions.

A quick checklist

Up nextEvery .wslconfig setting explainedWant every setting you can change, with defaults and Windows version limits? Our guide to every .wslconfig setting explains each one.

From circuittimes.com/cloud-dev/fix-vmmem-high-memory-in-wsl2/

Was this guide helpful?

Keep going

More in Developer Tools

See all

The briefing, without the noise.

The stories that matter in technology, every weekday morning.

Free. Unsubscribe in one click.