1、进入恢复模式
关闭或启动sip:
//打开终端输入 csrutil disable //完成后还是建议启用sip csrutil enable
2、查看虚拟内存
sysctl vm.swapusage
3、关闭虚拟内存:
//关闭虚拟内存 sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist //清除已经产生但缓存文件,某次重启但时候系统会自动删除 sudo rm /private/var/vm/swapfile*
4、开启虚拟内存:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
在刚开机时,swap用量为0。打开很多应用后,发现物理内存用量大约10g时发现swap开始使用。然后随着不断关闭应用,得出一个结论,swap的用量是系统动态调整的,内存用量越大,swap用量越大。