学习啦 > 学习电脑 > 操作系统 > 系统优化教程 > linux系统清理缓存教程

linux系统清理缓存教程

时间: 志艺942 分享

linux系统清理缓存教程

  今天用spot on light 查了一下开发服务器的内存占用,只剩下60MB,用下面的方法就可以实现清空缓存频繁的文件访问会导致系统的Cache使用量大增。接下来是小编为大家收集的linux系统清理缓存教程,欢迎大家阅读:

  linux系统清理缓存教程

  命令

  #sync

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

  查看内存情况:

  # more /proc/meminfo

  Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache...

  To use /proc/sys/vm/drop_caches, just echo a number to it.

  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

  This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. If you run "sync" first to flush them out to disk, these drop operations will tend to free more memory.

 
 看了“linux系统清理缓存教程”还想看:

1.清理Linux系统垃圾文件操作方法图文步骤详解

2.怎样清理Linux系统的垃圾文件

3.Linux系统怎样清理垃圾文件

4.Linux如何手动清理内存中cache信息

3042707