ubuntu清内存cache方法

cache释放:
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches

说明,释放前最好sync一下,防止丢数据。

可以在处理之前 输入free -h

处理后在输入 free -h

不过如果电脑不是特别卡,没必要清。

因为LINUX的内核机制,一般情况下不需要特意去释放已经使用的cache。这些cache起来的内容可以增加文件以及的读写速度。

猜你喜欢

转载自blog.csdn.net/qq_37610155/article/details/80290175