Linux操作系统如何释放cache内存
来源:asp之家 发布时间:2009-09-20 20:18:00
/proc是个虚拟文档系统,我们能够通过对他的读写操作做为和kernel实体间进行通信的一种手段.也就是说能够通过修改/proc中的文档,来对当前kernel的行为做出调整.那么我们能够通过调整/proc/sys/vm/drop_caches来释放内存.操作如下:
[root@server test]# cat /proc/sys/vm/drop_caches
0
首先,/proc/sys/vm/drop_caches的值,默认为0
[root@server test]# sync
手动执行sync命令(描述:sync 命令运行 sync 子例程。假如必须停止系统,则运行 sync 命令以确保文档系统的完整性。sync 命令将任何未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延迟的块 I/O 和读写映射文档)
[root@server test]# echo 3 > /proc/sys/vm/drop_caches
[root@server test]# cat /proc/sys/vm/drop_caches
3
将/proc/sys/vm/drop_caches值设为3
[root@server test]# free -m
total used free shared buffers cached
Mem: 249 66 182 0 0 11
-/+ buffers/cache: 55 194
Swap: 511 0 511
再来运行free命令,发现现在的used为66MB,free为182MB,buffers为0MB,cached为11MB.那么有效的释放了buffer和cache.
有关/proc/sys/vm/drop_caches的用法在下面进行了说明
/proc/sys/vm/drop_caches (since Linux 2.6.16)
Writing to this file causes the kernel to drop clean caches,
dentries and inodes from memory, causing that memory to become
free.
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(8) first.
猜你喜欢
- 10月12日消息,据国外媒体报道,互联网用户管理机构ViziSense最新数据显示,谷歌Gmail已经超越雅虎,成为印度最受欢迎的电子邮件服
- 网站中发布的文章除了需要按时间、栏目分类、类别调用外,往往需要根据编辑的推荐进行不同的调用,那么CMS自然少不了推荐位功能。一般推荐位的设计
- 12月16日,国内知名CMS厂商PHP168发布了其最新版的V6.02增强版,这个版本跟上一个版本相比,共改进了27项功能。大家如果对能需要
- 打开:template/admin/setstyles.htm查找<script type="text/javas
- 上篇文章介绍了怎样添加子域名,那今天我们来介绍如果想移除Godaddy子域名该怎样操作呢?需要注意的是:这以过程在HostingConfig
- VMware Workstation是一款功能强大的桌面虚拟计算机软件,用户可以在虚拟机同时运行各种操作系统,进行开发、测试、演示和部署,而
- 从2009年到2011年,接触Dedecms已经有2个年头了,在这期间使用DEDE制作了有10来个网站,有些网站也取得不错的搜索排名和流量,
- 注意:入侵时目标如果是linux服务器,看切忌清理痕迹的时候别忘记history命令的记录哦!1、修改/etc/profile将HISTSI
- 腾讯QQ密保卡是腾讯推出的一项帐号安全保护服务。它是一个记录着10行8列数字的卡片,在执行敏感操作(如在幻想游戏中转让装备、修改QQ密码)时
- 分词是很多做SEO的人常听到的概念,为了让大家在这个方面不会有疑惑,现在要来讲一下分词以及索引库。这也是更深入的了解搜索引擎的开始。搜索引擎
- 下面是来自可能吧收集整理一份的博客词汇手册, 包括国内外一些常用的博客用词, 博客相关服务, Feed服务网站, 订阅服务网站和
- 最近看电脑太多了,少有活动,到处酸痛,看来要多做运动。正好看到这个电脑操,一起运动一下。1、伸伸懒腰,松松骨,每小时都要做 2、推
- Godaddy主机是支持Zend Optimizer,但是,我看到一些朋友对它不了解,不知道它是做什么的,下面我就来介绍一下Zend Opt
- 百度产品线很多,能利用起来的也有很多。如果能完美的把百度产品线都利用起来,为自己的网站带来的效果是可想而知的。今天就和大家谈谈究竟如何完美的
- 虚拟机软件:vmware workstation镜像:deepin-desktop-community-1002-amd64.iso提前创建
- 在我未成熟的程序思考能力下,我首先否定了重写程序这个方法,再次否定了将PHPWind的验证方法引入到最土的方法,最后想出一个折中的办法,将两
- 纹身是神秘、性感和魅力的象征,也是张扬个性最独特的表现。可是纹身虽美,大多数MM还是因为害怕疼痛,不敢将纹身刺在身上。不过现在不用愁啦,用“
- FTP服务是Internet上的标准服务之一,用来在网络上传输文件。在linux系统中,通常用wu-ftpd来实现该服务(www.wu-ft
- 前天吧,晚上和朋友吃了饭聊网络,发现“www.SEOtest.cn”在Google中的排名掉了。搜索
- “Microsoft Security Essentials”(微软安全必备)可以防御运行Windo