-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL2 consume huge RAM and don't free them, also consume hug DISK I/O #9906
Comments
Seems like Docker is doing something inside the VM. Might be best to check with them first. |
I use TOP inside the WSL, it shows Docker does not consume that CPU,I/O and RAM. This memroy is not in used, but is buff/cached, that seems just WSL use it for cache. I/O can only be find by iostat, pidstat -d can not detect any process consume disk I/O. |
I have had similar issues on three occasions. I had to reinstall it to get back my storage space. The problem occurs when I run an analysis (resample of raster data). After the process- the size of the ext4.vdhx is over 500GB. Please fix this issue, it is very frustrating |
This issue is highly expected to be noticed and resolved by the authorities |
Same problem here |
Same issue here. Solved by following this thread: https://support.itsolver.net/hc/en-au/articles/5742283229967-How-to-fix-vmmem-high-memory-usage-with-Docker-WSL2 |
but still, this is a temporary solution :( |
I'm facing the same issue… VmmemWSL consumes 500 MB/s while I'm programming and it's annoying EDIT: |
To solve the high mem usage. Could try freeing disk cache by corn regularly using command This is more flexiable than limit the total memory of WSL2 instance. This issue have been presented since the day of WSL2 coming out. And could be ultimately solved by making WSL2 kernel using Windows Page Cache. But that solution may be too hard to be implemented and too invasive and may lead to more bugs. And that's why I dislike WSL2. |
WSL2 Disk & Memory Usage WSL_disk.usage.mp4 |
Yeah this is very bad. I have 128 GB ram and I really need like 90 GB for my workload – sometimes, but WSL2 just spends it and keeps it. This is completely unacceptable. |
Same here, have to do --shutdown each time I need something heavy on my host |
If you want a workaround you can log into the VM (type wsl in powershell) it will release all the not used memory |
You probably want to change this to
|
@aleeraser solution works beautifully. In my case, it took several minutes for the cache to clear; be patient. |
What @megabayt was facing can be elegantly solved by suggestion from @sharon8811 (and @aleeraser).
Simply execute those commands inside your VM and notice the memory getting released. I am using Windows 10 with WSL2, Ubuntu-24.04-LTS. I was originally doing what @megabayt did, but this command just did the trick to free up VM memory rightaway. Just for the curious,
|
How to run this on Docker?
|
Same here. |
What is interesting is that Nvidia GPU's VRAM on WSL2 is managed by Windows, therefore, WSL2's CUDA applications automatically share VRAM with Windows applications. You don't have to reserve VRAM for WSL2. On the other hand, you must reserve CPU memory for WSL2, or the WSL2's disk cache will eat all your CPU memory and never return it. |
[experimental] ref: https://learn.microsoft.com/en-us/windows/wsl/wsl-config#experimental-settings |
Windows Version
Microsoft Windows [版本 10.0.22621.1413]
WSL Version
1.1.6.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.90.1
Distro Version
Ubuntu-22.04
Other Software
Docker Desktop Version: 4.16.3 (96739)
Repro Steps
When Windows startup, after few minues, then wsl will auto consume a lot RAM.
Expected Behavior
Before I re-install this, it will keep about 4-5G memory. As the pic provied in #8725 it will also not use a lot I/O.
Actual Behavior
WSL will use about 20G memory and 700+ MB/s disk I/O. But from wsl, the memory is not actually used.
Addition: Memory can be released after few minues. But everytime start docker or wsl will result in hug memory consume.
Diagnostic Logs
Please tell me what log should I provide!
The text was updated successfully, but these errors were encountered: