Limit the memory usage of WSL2-based projects

Edit on GitHub

When running Spryker on WSL2, the memory usage of VMmem can get significant, even if the memory usage of the instance is small.

This document explains how to limit the memory usage of this process.

Prerequisites

Ensure that you have the latest versions:

  • Windows 10 or Windows 11
  • Docker for Windows

Limit the memory usage of VMmem

  1. Create or update c:\users\USERNAME\.wslconfig with memory and processors parameters per your hardware and performance requirements.

The following example suits most use cases.

memory=4GB # Sets the memory limit to 4 GB.
processors=2 # Sets the number of CPU cores WSL2 is allowed to use to 2.
  1. Restart the LXSSMANAGER service:
    1. In the Start menu, enter Services and press Enter.
    2. Right-click the LXSSMANAGER service and select Restart.

refresh-lxssmanager-service

After these steps, the VMmem memory usage does not exceed the specified limit.