查看内存:
[root@iZ9dp52tlpqyihuisujjswZ bin]# free -h
total used free shared buff/cache available
Mem: 31G 8.3G 792M 828K 22G 22G
Swap: 0B 0B 0B
执行同步:
[root@iZ9dp52tlpqyihuisujjswZ bin]# sync
释放内存:
[root@iZ9dp52tlpqyihuisujjswZ bin]# cat /proc/sys/vm/drop_caches
0
[root@iZ9dp52tlpqyihuisujjswZ bin]# echo 1 > /proc/sys/vm/drop_caches
查看效果:
[root@iZ9dp52tlpqyihuisujjswZ bin]# free -h
total used free shared buff/cache available
Mem: 31G 8.3G 22G 828K 606M 22G
Swap: 0B 0B 0B
恢复配置:
[root@iZ9dp52tlpqyihuisujjswZ bin]# echo 0 > /proc/sys/vm/drop_caches