TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: WSL2 users how you are handling the RAM usage?

8 pointsby izwasmover 2 years ago
It's so annoying really no matter the ram you give it just eats all of it, when i run my projects locally hot reloading becomes so so slow. I dont know why microsoft recommends it and it unbelievebly unusable. Also the problem has been around since the creation of wsl why microsoft didnt find a solution yet ?

5 comments

nikauover 2 years ago
You specify the wsl2 ram limit in the config file.<p>By design it will end up using all the allocated ram for caches and linux programs.<p>If you really need to free ram for windows apps you can flush caches by running below as root<p>echo 1 &gt;&gt; &#x2F;proc&#x2F;sys&#x2F;vm&#x2F;drop_caches
pxcover 2 years ago
Yeah there seems to be a memory leak in Hyper-V somewhere. Spinning up Docker containers on-demand (like for a local GitHub runner, for example) instantly gobbles up the whole allotment and, on defaults, makes my 32GB work computer totally unusable.<p>I really wish I could just run proper Linux on the metal. Docker under emulation is such a disaster! I don&#x27;t understand how it&#x27;s the norm.
评论 #34681615 未加载
评论 #34682914 未加载
NGRhodesover 2 years ago
By default WSL2 should only be using 8GB ram or 50%, which ever is lower.<p>As far as I know, the high memory usage of WSL2 is due Linux using as much spare RAM as possible for caching and WSL2 having to allocate memory for this cache. Both Linux and Windows memory ballooning under KVM&#x2F;QEMU manages dynamically manage memory and work around memory caching.<p>I suspect the issue with WSL2 allocated memory being quickly consumed by cache could be currently a limitation of the Hyper-V hypervisor or the WSL2 kernel.
kristianpover 2 years ago
What&#x27;s your specific use case? I haven&#x27;t noticed any problems, but my usage is pretty light, with python scripts and some docker containers.
评论 #34689170 未加载
Allyedgeover 2 years ago
I believe there was a configuration file for that.<p>I just set it to 12 GB max, since I have 32 GBs of RAM, and it works just great.