Running out of memory in wsl

2023-08-03

I keep running out of memory in my wsl instances when working on dev projects, especially during build time.

By default, WSL apears to be set to 4GB of memory.

To resolve this, I went into my user folder, example: c:/Users/username

Then add a file called .wslconfig

Add the following configuration into this file

[wsl2]
memory=16GB

When you restart WSL, and run the command free , the amount available under free should match what you have set it to.