查看进程占用内存情况:
ps -aux
VSZ表示占用虚拟内存单位KB
RSS表示占用物理内存单位KB
添加swap文件大小为4G 内部存储块每块1M
dd if=/dev/zero of=/swap bs=1024 count=4096000
创建交换分区
mkswap /swap
激活交换分区
swapon /swap
持久保存
vim /etc/fstab /swap swap swap default 0 0
撤销虚拟内存步骤
释放swap文件
swapoff /swap
删除swap文件
rm -rf /swap