Docker Vmmem process takes too much memory in Windows 11 / 10

Users who have installed Docker using Windows Subsystem for Linux2 on their Windows machines have complained of experiencing vmmem process consuming a huge amount of memory power. According to these affected users, this memory drain is going off the charts, sometimes even reaching up to 99% (1.5-2 GB of RAM)! This is a concerning issue as this slows down the affected system significantly. So, you should follow these fixes to solve the problem.


ADVERTISEMENT

Fix 1 – Let it run

The vmmem process continues to run even after you have closed the WSL2. This is the normal behavior and vmmem can continue to consume higher amounts of system resources up to 1-2 minutes after ending the vmmem process. So, wait until that point till it stops and eventually releases the memory.

Fix 2 – Shutdown the WSL

The best way to stop Docker from using too much memory is to shut down the Windows Subsystem for Linux.

NOTE – As this stops the WSL2, you should be careful about running this at the time of need only. So, only run this when you are done running the Docker and you don’t need it any further.

1. You can do this from any terminal but you have to open it with administrative rights. So, open the search box and type “powershell“.

2. Then, right-click the “Windows PowerShell” and click “Run as administrator” to open the terminal as an admin.


ADVERTISEMENT


 

Powershell Run As Admin Min
powershell run as admin min

 

3. Now, write this in the terminal and hit Enter to shut down the Windows Subsystem for Linux.

wsl --shutdown

 

Wsl Shutdown Min 1
wsl shutdown min 1

 

This will shut down the WSL2 and eventually, vmmem will stop consuming massive amounts of memory.


ADVERTISEMENT

 

Fix 3 – Restrict memory usage

There is another way you can bind the memory usage by WSL2. You can create a new configuration file or edit the existing one.

Step 1

1. At first you have to close the WSL2 configuration.

2. So, start to type “powershell” in the search box.

3. Then, right-click the “Windows PowerShell” and click “Run as administrator” to run the terminal as an admin.

 

Powershell Run As Admin Min
powershell run as admin min

 

4. After this, run this code to stop WSL2 immediately.

wsl --shutdown

 

Wsl Shutdown Min 1
wsl shutdown min 1

 

After this, you may close the PowerShell terminal.

 

Step 2

Now, you have to create a configuration file. So, glide through these points.

1. Search and open Notepad.

 

Notepad Min
notepad min

 

2. There, paste these two lines.

[wsl2]
memory=2GB # Limits VM memory in WSL 2 up to 3GB
processors=2 # make the WSL 2 use up to two virtual processors

 

[NOTE – You can see in the config file, we have set the memory parameter to 2 GB and virtual processors count to 2. These are the modifiers and you can set them as you want.]

 

Ws Memory Min
ws memory min

 

3. After that, click on “File” and click “Save as” to save the file.

 

Save As Min
save as min

 

4. Now, name the file “%UserProfile%\.wslconfig“.

5. Then, click “Save” to save the file.

 

Save Config Min
save config min

 

You may close Notepad after this.

After this, open Docker. As soon as you open that, you will see the option to restart the virtual machine.

So, click “Yes” to restart that.

Now, the vmmem won’t eat up a high amount of RAM.

Optional Steps

Linux consumes more memory to cache files. You can prevent this with this single line (run from an administrative terminal) –

echo 3 | sudo tee /proc/sys/vm/drop_caches

This should limit the cache storage and free up more RAM for the host.

Fix 4 – Restart the LxssManager

You have to restart the LxssManager in PowerShell.


ADVERTISEMENT

1. Open PowerShell or any other terminal as an admin.

2. Then, input this command and hit Enter to restart the LxssManager.

Restart-Service LxssManager

 

Restart Lxsmanager Min

 

Then, check the RAM consumption once more.

 

Fix 5 – Increase allotted resources

You can increase allotted RAM, and CPU and swap easily so that vmmem consumption reduces significantly.

1. Open Docker Settings [ You may have to run Docker VM in Linux mode to see this settings.].

2. There, go to the “Advanced” setting.

3. Inside it, you can tweak the CPU, Memory, and Swap settings according to the available system resources.

This should reduce the vmmem resources consumption significantly.

ADVERTISEMENT