wsl2 很能吃内存,而且 Windows10 抢不过 wsl2

2021-01-23 16:26:20 +08:00
 systemcall

电脑只有 16G 的内存,装了 wsl2 和使用 wsl2 的 docker-desktop
wsl2 里面编译点东西,有时候就会把内存占满,之后就连 wallpaper engine 都开始卡,chrome 和新 edge 也开始频繁的重载网页
关键是 wsl2 吃了的内存,程序不用了之后被 wsl2 用来当缓存了,win10 吃不到内存只能用页面文件撑着

170 次点击
所在节点    自言自语
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

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/747700

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX