Skip to content

Latest commit

 

History

History
22 lines (12 loc) · 1.25 KB

README.md

File metadata and controls

22 lines (12 loc) · 1.25 KB

wsl-drop-caches

Periodically drop the WSL caches when load is low.

This is a systemd-based implementation of validatedev / drop-cache-if-idle, using the same underlying python script, but modified to run from a systemd timer and to be installed using an apt package.

Why?

To quote the original author:

In WSL2 (Windows Subsystem for Linux, version 2), there's a bug microsoft/WSL#4166. Due to that issue, WSL2 doesn't return the cache, instead, the amount of cache grows until the WSL2 instance's assigned RAM is full. Well, you can simply drop the cache. But, there would be a problem for the speed of your process. Instead, the script makes sure that the WSL2 instance is idle, then drops the cache. With that approach, we could eliminate the speed issue, for some of the cases.

And this is the simple-to-install-and-use version for genie/systemd users.

Installation

  1. Set up the WSL Transdebian repository following the instructions here, if you have not already done so.

  2. apt install wsl-drop-caches

  3. Either restart WSL, or sudo systemctl start wsl-drop-caches.