[Linux] Vmmem 記憶體佔用過高(wsl, ubuntu)


Posted by mike-hsieh on 2024-05-20

如題,當使用 wsl 時,windows會有一個 Vmmem 程序運行,並且佔用的記憶體資源相當高。
以下附上解決方式。

Step1: 按下Windows + R 鍵,輸入 %UserProfile% 並運行進入使用者資料夾

Step2: 新增檔案 .wslconfig ,如果存在就覆蓋,重新配置一個,然後記事本編輯:
更多配置可以查看文檔 => https://learn.microsoft.com/zh-cn/windows/wsl/wsl-config

# 如果妳的記憶體是32G,且沒有其他程式運行,可以配置12GB以上給wsl。
# 32G Settings apply across all Linux distros running on WSL 2
[wsl2]
memory=12GB
swap=4GB
localhostforwarding=true
# 我目前只有16G,且會開很多程式,所以我只用最低限度的記憶體來啟用即可。
# Minimize setting
[wsl2]
memory=1GB
swap=1GB
localhostforwarding=true

Step4: 關閉wsl、啟用wsl

# 關閉整個 wsl
wsl --shutdown

# 運行Ubuntu。(僅為範例,這邊就看您自己的配置了!)
wsl -d Ubuntu


參考資料:
https://www.choudalao.com/article/314


#linux #Vmmem #wsl #ubuntu #memery high







Related Posts

NodeJS 與 CommonJS 到 ESM 與 Webpack

NodeJS 與 CommonJS 到 ESM 與 Webpack

{210409} Hello, World!

{210409} Hello, World!

v-on 各種修飾符

v-on 各種修飾符


Comments