zoukankan      html  css  js  c++  java
  • linux清理缓存

    查看缓存的命令

      free -m

    清理缓存的命令 

       echo 1 > /proc/sys/vm/drop_caches

              echo 2 > /proc/sys/vm/drop_caches

              echo 3 > /proc/sys/vm/drop_caches

    说明:
    1>. /proc是一个虚拟文件系统,我们可以通过对它的读写操作作为与kernel实体间进行通信的一种手段。也就是说可以通过修改/proc中的文件,来对当前kernel的行为做出调整。也就是说我们可以通过调整/proc/sys/vm/drop_caches来释放内存。
    0 – 不释放
    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.
     
    3>. Linux内核会将它最近访问过的文件页面缓存在内存中一段时间,这个文件缓存被称为pagecache。
    Inode是linux/unix操作系统中的一种数据结构,包含了各文件相关的一些重要信息。在创建文件系统时,就会同时创建大量的inode。一般inode表会占用文件系统磁盘空间的1%。
  • 相关阅读:
    没有纳入spring管理的类如何注入spring管理的对象
    Servlet里面url-pattern的通配符*的使用规则
    【转】request和response的页面跳转传参
    Mybatis-Generator逆向生成Po,Mapper,XMLMAPPER(一)
    Sae上传war包找不到编译文件
    Maven配置中scope说明
    Spring配置中的classpath和classpath*的区别
    国内的ntp服务器
    U盘拷贝文件大小有限制吗?
    Genymotion安装教程
  • 原文地址:https://www.cnblogs.com/yuanqc/p/10842772.html
Copyright © 2011-2022 走看看