With WSL2, apps will now use either 50% or 8GB of your available memory.
Happy coding!
With WSL2, apps will now use either 50% or 8GB of your available memory.
Happy coding!
PS C:\Users\2ion> cat .\.wslconfig
[wsl2]
memory=6G
processors=4
These settings are being respected, as far as I can tell. Since when is it not common sense to assign a reasonable amount to a VM? The only thing that does not seem to work well at the moment is a "memory balloon" RAM allocation scheme. WSL2 is a VM, not a shared memory container. They could do better, but RAM is pretty cheap nowadays and WSLg is IMO the much more productive feature.See https://docs.microsoft.com/en-us/windows/wsl/wsl-config#conf....
(This comment coming from someone who used to have to support running small backup MSSQL instances on Windows 8 tablets.)
Can I ask what the use case was? Was it just in case the primary DB server died and they wanted a battery powered backup?
Unfortunately like a process there is no way for windows to request memory back from linux (besides killing the entire thing). So its up to the linux kernel to decide what to release back.
What that configuration does is limit the maximum amount of memory it can request (what the linux kernel sees as the total system memory). The reason you need to set a limit right now is that the linux kernel will pretty quickly request most of your windows memory to use as page cache if you don't limit it.
Microsoft is working to allow the linux kernel to use the windows page cache instead of maintaining a separate one.
https://github.com/microsoft/WSL/issues/4166#issuecomment-64...
... since july 2019, a locked discussion, a lot of dupes, and no progress to report thus far.
I have long thought it would make sense to add a way for the OS to ask processes to relinquish memory that they can do without. A lot of processes have memory that they use for caching which can safely be dropped but doing so when the memory is not needed elsewhere unnecessarily limits performance.
What exists already in the Windows VMM, and I assume other OSes VMMs, is a distinction between allocated and committed. That's likely to be the best that's realistically achievable. The win VMM also has a last-accessed strategy for paging to disk, and de-duplication of shared pages.
https://docs.microsoft.com/en-us/windows/wsl/wsl-config#conf...
You can read about it here: https://github.com/microsoft/WSL/issues/4197
In practice, this turns out to have meant DOS, OS/2, and a barebones POSIX workalike. Modern Linux is too huge and provides useful APIs that go against the grain of modern NT, so applications are slow in WSL1 and there are too many impedance mismatches to paper over to make the investment worth the effort.
PS C:\Users\1_player> cat .\.wslconfig
[wsl2]
memory=32GB
Eh, who cares.Btw, notebooks have soldiered ram.
https://www.linuxatemyram.com/
Weird that i didn't knew this. Couple of years ago i wasted some time to get more "free" memory on my server. Lol