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来释放内存。

  • 相关阅读:
    【转载】如何学JavaScript?前辈的经验之谈
    javascript基础学习心得01
    CSS之浮动
    HTML5基础学习心得
    如何使用HTML5的canvas属性
    HTML标记语言
    HTML+CSS学习
    线性表
    (2)协程之 greenlet模块
    (1)协程之理论
  • 原文地址:https://www.cnblogs.com/trying/p/3447305.html
Copyright © 2011-2022 走看看