电脑只有 16G 的内存,装了 wsl2 和使用 wsl2 的 docker-desktop
wsl2 里面编译点东西,有时候就会把内存占满,之后就连 wallpaper engine 都开始卡,chrome 和新 edge 也开始频繁的重载网页
关键是 wsl2 吃了的内存,程序不用了之后被 wsl2 用来当缓存了,win10 吃不到内存只能用页面文件撑着
1
jswh 2021-01-25 13:57:55 +08:00
Workaround: Create a %UserProfile%\.wslconfig file in Windows and use it to limit memory assigned to WSL2 VM.
Example [wsl2] memory=6GB swap=0 localhostForwarding=true This will still consume the entire 6GBs regardless of Linux memory usage, but at least it'll stop growing more than that. Supported settings are documented here. https://github.com/microsoft/WSL/issues/4166 |