In Windows 10, a process called vmmem occupies too much memory for troubleshooting analysis
1. In Windows 10, it feels like a lot of lag. View Task Manager, 98% memory usage. The process named vmmem takes up to 2.1 GB of memory. as shown in Figure 1
2. The VMMMEM process is a virtual process synthesized by the system, which is used to represent the memory and CPU resources consumed by the virtual machine. In other words, if you see a VMMMEM consuming a lot of memory and CPU resources, then this means that your virtual machine is consuming a lot of memory and CPU resources. If you want it to stop, turn off your virtual machine.
3. I think the reason should be that Docker is running on the operating system, and it may also be used by the ongoing development. Try to find Docker Desktop and exit it, then the task should disappear. Or set the memory and CPU usage limit of Docker Desktop.
4. Open Docker Desktop, Settings – Resources – Advanced. You are using the WSL 2 backend, so the resource limit is managed by Windows. You can configure the limit of memory, CPU, and swap size allocated to WSL 2 in the .wslconfig file. as shown in Figure 2
5. Click .WSLConfig to link to Advanced Settings Configuration in WSL: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig . WSL 2 operates as a light virtual machine (VM), so the amount of memory or processor used can be controlled using the virtualization settings.
6. Use CD ~ to access the home directory in PowerShell (usually the user configuration file C:\Users\<username>). Directory: C:\Users\Lenovo. as shown in Figure 3
PS C:\Windows\System32> cd ~ PS C:\Users\Lenovo> ls Directory: C:\Users\Lenovo Mode lastwritetime length name -------------------------------- D---- 2021/12/20 18:13 .aws D---- 2021/12/20 18:13 .azure D----- 2021/12/25 16:22 .docker D---- 2021/12/20 16:23 .RDM D----- 2022/1/10 10:27 .ssh D-R--- 2021/12/19 10:29 3D Objects D-R--- 2021/12/19 10:29 Contacts D-R--- 2022/1/17 9:05 Desktop D-R--- 2022/1/7 9:32 Documents D-R--- 2022/1/25 16:35 Downloads D-R-- 2021/12/19 10:29 Favorites D-R--- 2021/12/19 10:29 Links D-R--- 2021/12/19 10:29 Music DAR--L 2022/1/25 9:07 OneDrive D-R--- 2021/12/19 10:31 Pictures D-R-- 2021/12/19 10:29 Saved Games D-R--- 2021/12/19 10:30 Searches D-R--- 2022/1/10 9:04 Videos -a--- 2021/12/30 16:01 1387 .bash_history -a--- 2021/12/27 15:30 177 .gitconfig -a--- 2022/1/24 10:34 20 .lesshst -A--- 2021/12/30 9:16 29 .minttyrc -A--- 2022/1/17 13:54 121 .yarnrc -A---- 2022/1/6 18:00 206 _Netrc PS C:\Users\Lenovo>
7. Since the file c:\users\lenovo\.wslconfig does not exist, it will be created new. Processors: The number of processors to allocate to the WSL 2 VM. The same number of processors on Windows. Memory: The amount of memory to allocate to WSL 2 VM. 50% or 8GB of total memory on Windows, whichever is the smaller one; on versions before 20175: 80% of the total memory on Windows. SWAP: The amount of swap space to be added to the WSL 2 VM, 0 means no swap file. Swap storage is a disk-based RAM used when memory requirements exceed hardware device limits. 25% of the memory size on Windows is rounded to the nearest GB. LocalhostForwarding: A boolean value that specifies whether the ports bound to the WSL 2 VM or the localhost should be connected from the host via localhost:port. The memory of my computer is 16 GB, the processor is Intel(R) Core(TM) I5-7200U CPU @ 2.50GHz 2.71 GHz, the number of cores: 2, the number of threads: 4.
# Settings Apply Across All Linux Distros Running on WSL 2 [wsl2] # limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB memory=2GB # sets the VM to use two virtual processors processes=2 # Specify a custom linux kernel to use with your installed distros. The default kernel used can be found at https://github.com/microsoft/wsl2-linux-kernel # kernel=c:\\temp\\mycustomkernel # Sets Additional Kernel Parameters, in this case enabling old Linux base images # KernelCommandLine = vsyscall=emulate # sets amount of swap storage space to 8GB, default is 25% of available RAM swap=4GB # sets swapfile path location, default is %userprofile%\appdata\local\temp\swap.vhdx # swapfile=c:\\temp\\wsl-swap.vhdx # disable page reporting so wsl all allocated memory claimed from # pagereporting=false # turn off default connection to bind wsl 2 localhost to windows localhost localhostforwarding=true # Disables Nested Virtualization # nestedvirtualization=false # turn on output console showing contents of dmesg when opening a wsl # debugconsole=true
8. Run wsl –shutdown to turn off the WSL 2 VM, and then restart the WSL instance (that is, restart Docker Desktop) to make these changes take effect. as shown in Figure 4
ps c:\users\lenovo> wsl --shutdown PS C:\Users\Lenovo>
9. Check the task manager again, the memory usage is 92%. The memory occupied by a process called vmmem is still close to 1.8 GB, which has declined, and the system has eased. as shown in Figure 5
10. If you run wsl –shutdown to turn off WSL 2 VM, and then stop restarting the WSL instance (that is, exit Docker Desktop). Check the task manager again, the memory occupies 80%. And the process named vmmem has disappeared. as shown in Figure 6
11. In summary, if you need to run Docker Desktop in Windows 10, the memory configuration is 32 GB or more suitable. When planning a new notebook, the configuration memory is 32 GB.





