1. 问题最近安装dify之后发现电脑特别卡尤其还在做开发任务时动不动电脑卡死后来发现Vemmen吃了十几个G内存。。。2. 思路这是因为我们没有修改wsl配置Vemmen放开了手脚所以我们给wsl做些小小的限制就可以愉快的开发了。3. 解决去系统个人用户的目录下看看有没有.wslconfig文件如果没有就自己配置下。我们需要配置wslconfig文件可以考虑用代码编辑器打开对于配置内容请无脑冲或者自行查询内容。# Settings apply across all Linux distros running onWSL2[wsl2]# LimitsVMmemory to use no more than4GB,#thiscan besetaswhole numbers usingGBorMBmemory2GB # Sets theVMto use two virtual processors processors2# Specify a custom Linux kernel to usewithyour installed distros.# Thedefaultkernel used can be found at https://github.com/microsoft/WSL2-Linux-Kernel # kernelC:\\temp\\myCustomKernel # Sets additional kernel parameters,#inthiscaseenabling older Linux base images suchasCentos6# kernelCommandLinevsyscallemulate # Sets amountofswap storage space to 8GB,defaultis25%ofavailableRAMswap4GB # Sets swapfile path location,defaultis%USERPROFILE%\AppData\Local\Temp\swap.vhdx # swapfileC:\\temp\\wsl-swap.vhdx # Disable page reporting soWSLretains all allocated memory claimed from Windows # and releases none back when free # pageReportingfalse# Turn offdefaultconnection to bindWSL2localhost to Windows localhost localhostforwardingtrue# Disables nested virtualization # nestedVirtualizationfalse# Turns on output console showing contentsofdmesg # when opening aWSL2distrofordebugging # debugConsoletrue使用管理员身份运行cmd命令如下wsl--shutdown重启docker万事大吉哈哈最后就可以看到Vmmem被限制了再也不用担心内存爆满卡机了。