microsoft / microsoft/WSL

On/Off hard switch for WSL to optimize win10 for other functions

Open
#5,114 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

WSL with docker desktop and kubernetes is amazing but ends up taking too much memory. There are workarounds to restrict the memory space allowed by wsl but somewhere among wsl,docker for desktop and it's kubernetes, there is something always taking too much memory space. If the host (Windows 10) is shared with other non-dev purposes then this becomes a problem.

Even after a wsl --shutdown the vmmem process still recovers with a minimum of 250MB usage. If the docker for desktop is active, then if it manages to reload kubernetes then it jumps to almost 3GB.

Describe the solution you'd like
There should be an on/off switch for WSL service. As great as it is, with this behavior it acts more of a memory hog that can retrieved without some hard actions. A host has multiple purposes. Like with gaming optimizations we should be able to choose when this combo runs and when not to optimize for the other purposes when necessary.

I think we all understand the amazing accomplishment of WSL and especially version 2 and that memory management could be leaky or non-recoverable and this is why a hard switch is necessary.

I also think that if this switch has an API, docker desktop could leverage to monitor and act accordingly.

Describe alternatives you've considered
At this moment, the only way to get it to a reasonable memory usage is to disable kubernetes from docker desktop and then wsl --shutdown to make sure the memory cleans up because otherwise the vmmem isn't releasing the memory.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are identified. Start by reproducing the reported memory behavior with Docker Desktop and Kubernetes, including wsl --shutdown, then trace the existing WSL shutdown entry point and the vmmem behavior. Done means a reliable WSL on/off switch exists, with the requested API if supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, kubernetes
Domain
devops, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.