VmmemWSL: What is it, why it consumes so much memory, and how to shut it down

If like me, you’ve noticed a process called vmmemwsl using up a big chunk of your memory, this article should help you to understand what it is, why it uses so much memory and how to stop it.

What is VmmemWSL?

Vmmem is a process associated with Windows Subsystem for Linux (WSL). WSL allows you to run a Linux environment directly within Windows, enabling seamless interaction between Windows and Linux applications. Vmmem specifically pertains to WSL 2, which is an improved version of WSL.

Why does vmmem use so much memory?

When you start WSL 2, it allocates a significant amount of memory by default (~4GB). This allocation ensures that the Linux environment can run smoothly. However, this can lead to high memory usage, especially if you’re not actively using WSL.

If you’re using Docker with WSL 2 as the backend, vmmem will continue to consume RAM even after you close Docker containers, and even Docker itself. This behavior is because WSL 2 maintains its resources for better performance.

    How shutdown VmmemWSL

    To temporarily reduce memory usage, run the following command in PowerShell (run as admin), which will stop all WSL instances, including Docker containers:

    :wsl --shutdown

    If you’ve closed all of your Docker containers, you can be patient, and it should eventually release the memory, but I’ve seen occassions where this doesn’t happen. Because of this, I now no longer have Docker open at startup.

    How to limit the memory assigned to VmmemWSL

    Create a file called .wslconfig in your user profile folder (%UserProfile%), if it doesn’t exist already, and limit the memory assigned to WSL 2 by using the below example, which will limit the memory to 3GB:

    [wsl2] memory=3GB 

    For more configurations, consult Microsoft’s Advanced settings configuration in WSL page.


    VmmemWSL might be a memory hog, but with a little configuration and understanding, you can manage its impact effectively. Keep in mind though, that it’s an essential part of WSL 2, so striking the right balance between performance and resource usage is crucial, so you might have to try a few settings before you find what works well for you.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.