zoukankan      html  css  js  c++  java
  • linux手工释放内存

    先使用sync命令以确保文件系统的完整性,sync 命令运行 sync 子例程,将所有未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延迟的块 I/O 和读写映射文件。

    再执行下面任意一条命令:

    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.

    /proc是一个虚拟文件系统,我们可以通过对它的读写操作作为与kernel实体间进行通信的一种手段。也就是说可以通过修改/proc中的文件,来对当前kernel的行为做出调整。也就是说我们可以通过调整/proc/sys/vm/drop_caches来释放内存。

  • 相关阅读:
    IE8下,时间函数问题
    sublime有时候用快捷键时出现的是css的快捷键
    热词高亮并去重
    关于百分比的margin
    手机端后退功能
    CSS3小水滴代码
    关于Gmapping的学习2
    关于概率运动模型
    A*算法的学习
    经典ICP算法
  • 原文地址:https://www.cnblogs.com/trying/p/3447305.html
Copyright © 2011-2022 走看看