Centos释放linux系统内存

Linux中频繁读写文件时,内存资源被耗尽,当程序结束后,内存不会释放需要清除缓存。缓存的类别有dentry,buffer cache,page cache。

echo 1 > /proc/sys/vm/drop_cache #释放page cahce

echo 2 > /proc/sys/vm/drop_cache #释放dentry和inode

echo 3 > /proc/sys/vm/drop_cache #释放page cache,dentry,inode

注:Dentry用来加速文件路径名到inode的转换;buffer cache加速磁盘块的读写;page cache加速inode的读写。缩短IO调用时间。

在系统中用U盘的拷贝文件时可用sync命令,来将写入缓存中的文件立即写入到U盘等移动设备中

猜你喜欢

转载自blog.51cto.com/14163901/2399830