0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WSL2が遅くてたまらない

Posted at

困ってる事

Windows10 バージョン 20H2を使ってます。

WSL2で作業していると、それほどゴリゴリ使ってるつもりがなくてもPC全体が重くなることがありました。特にブラウザーの動作が遅くなって、作業にならない等。

WSLのコンソールで free -mを実行すると6GBメモリを使用。
PCのメモリーは8GBでこれは完全なメモリー不足。

どうもWSL2がメモリーを解放しない病気があるらしい。
これじゃあ、WSL2の良さも半減だなぁ。何とかしてほしい。

私の解決策

%USERPROFILE%\.wslconfigを作成し、WSL2に割り当てるメモリーの上限を設定。内容は次の通り

%USERPROFILE%.wslconfig
[wsl2]
memory=2GB
swap=2GB

memory, swapの量はお好みで調整してください。
本体のメモリーが8GBとちょっと少な目なので、WSLに2GBまでに抑えて、足りないところはSWAPで頑張れ(増設のnVMEのSSD頼む)という感じにしてみました。
image.png

参考
https://www.google.com/search?q=wsl2+vmmem&oq=wsl2+vmmem

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?