- 按下Windows + R 鍵,輸入
%UserProfile%
並運行進入用戶文件夾 - 新建文件
.wslconfig
,然後記事本編輯 - 輸入以下內容並保存,
memory
爲系統內存上限,這裏我限制最大2gb
[wsl2]
memory=2GB
swap=0
localhostForwarding=true
- 啓動cmd命令提示符,輸入
wsl --shutdown
來關閉當前的子系統然後重新打開
%UserProfile%
並運行進入用戶文件夾.wslconfig
,然後記事本編輯memory
爲系統內存上限,這裏我限制最大2gb[wsl2]
memory=2GB
swap=0
localhostForwarding=true
wsl --shutdown
來關閉當前的子系統然後重新打開