Hacker News new | ask | show | jobs
by skazazes 978 days ago
Is this the reason Windows Task Manager seems to show Vmmem (WSL2) as gobbling up well more RAM then WSL seems to indicate is in use?

I have more then enough RAM on my office workstation to just accept this, but on my personal gaming computer that moonlights as a dev machine, I run into issues and have to kill WSL from time to time.

4 comments

That's just one part of the issue - even after forcefully dropping Linux's caches, WSL has been unable to reclaim the memory back reliably. There has been a recent update that claims to finally fix this.

You might find this package helpful: https://github.com/arkane-systems/wsl-drop-cache

It's also really annoying that "drop caches" seems to be the only interface here. No way to simply limit it.
I think there is some conflict between the disk cache running inside WSL and the memory management outside. I tried turning up memory pressure in WSL but it didn't help. This does work but I have to run it manually from time to time:

  # sync; echo 3 > /proc/sys/vm/drop_caches
No, that's because WSL (until v2/very recently) didn't properly release memory back to windows. This actually would cause docker to effectively leak memory really quickly.
The worst offense of wsl2 is writing files to ram before copying it to the native filesystem unusable with lots of data.