查看缓存的命令html
free -mnode
清理缓存的命令 linux
echo 1 > /proc/sys/vm/drop_caches缓存
echo 2 > /proc/sys/vm/drop_cachespost
echo 3 > /proc/sys/vm/drop_cachesthis
echo 0 是不释放缓存url
echo 1 是释放页缓存htm
ehco 2 是释放dentries和inodes缓存blog
echo 3 是释放 1 和 2 中说道的的全部缓存内存
说明:
1>. /proc是一个虚拟文件系统,咱们能够经过对它的读写操做做为与kernel实体间进行通讯的一种手段。也就是说能够经过修改/proc中的文件,来对当前kernel的行为作出调整。也就是说咱们能够经过调整/proc/sys/vm/drop_caches来释放内存。
1>. /proc是一个虚拟文件系统,咱们能够经过对它的读写操做做为与kernel实体间进行通讯的一种手段。也就是说能够经过修改/proc中的文件,来对当前kernel的行为作出调整。也就是说咱们能够经过调整/proc/sys/vm/drop_caches来释放内存。
0 – 不释放
1 – 释放页缓存
2 – 释放dentries和inodes
3 – 释放全部缓存
1 – 释放页缓存
2 – 释放dentries和inodes
3 – 释放全部缓存
数字1是用来清空最近放问过的文件页面缓存
数字2是用来清空文件节点缓存和目录项缓存
数字3是用来清空1和2全部内容的缓存。
2>. 关于drop_caches的官方说明以下:
Writing to this file causes the kernel to drop clean caches,dentries and inodes from memory, causing that memory to becomefree.
To free pagecache, use echo 1 > /proc/sys/vm/drop_caches;
to free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches;
to free pagecache, dentries and inodes, use echo 3 >/proc/sys/vm/drop_caches.
Because this is a non-destructive operation and dirty objects are not freeable, the user should run sync first.
To free pagecache, use echo 1 > /proc/sys/vm/drop_caches;
to free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches;
to free pagecache, dentries and inodes, use echo 3 >/proc/sys/vm/drop_caches.
Because this is a non-destructive operation and dirty objects are not freeable, the user should run sync first.