How to reduce RAM used by MCP servers that require docker

:brain: Windows 11 – Solving High RAM Usage by vmmemWSL

Problem:
Excessive RAM consumption (sometimes matching Cursor’s usage) by the vmmemWSL process, even when Docker/MCP tools aren’t actively running any containers.

Root Cause:
Docker Desktop (used by MCP) runs inside WSL2 by default. WSL2 dynamically consumes as much memory as available, unless explicitly limited.

Solution:
You can reduce WSL2’s memory usage by editing your .wslconfig file.

:warning: Disclaimer:
This solution is ideal if you’re not actively developing with Docker.
Limiting RAM can affect container performance, especially for builds, complex services, or databases running inside Docker.

Steps:

  1. Open or create this file:
    C:\Users\YourUsername\.wslconfig

  2. Add the following configuration:

    [wsl2]
    memory=1GB         # Limit WSL to 1GB of RAM
    processors=2       # Limit to 2 CPU cores
    swap=0             # Disable swap (optional)
    
    [experimental]
    autoMemoryReclaim=true  # Enable memory reclaiming (recent builds)
    
  3. Apply the changes:

    wsl --shutdown
    
  4. Restart Docker if necessary.

I hope it helps!