file cache linux,linux flushing file system caches

本文介绍了如何在Linux系统中通过/proc/sys/vm/drop_caches来释放内存,包括页缓存、dentries和inodes。首先使用sync命令将脏对象刷新到磁盘,然后通过向/proc/sys/vm/drop_caches写入数值3来清除缓存。这是一个非破坏性的操作,只释放未使用的资源。
摘要由CSDN通过智能技术生成

We may drop the file system caches on Linux to free up memory for applications. Kernels 2.6.16 and newer provide a mechanism via the /proc/ to make the kernel drop the page cache and/or inode and dentry caches on command. We can use this mechanism to free up the memory. However, this is a non-destructive operation that only free things that are completely unused and dirty objects will not be freed until written out to disk. Hence, we should flush these dirty objects to disk first. We can run sync to flush them out to disk. And the drop operations by the kernel will free more memory.

We can flush caches of the file systems by two steps:

Flush file system buffers

Call the sync command:

# sync

Free pagecache, dentries and inodes

Just echoing a number to /proc/sys/vm/drop_caches:

# echo 3 > /proc/sys/vm/drop_caches

原文:https://www.cnblogs.com/longchang/p/10767434.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值