linux 清内存
注意:首先我们需要使用sync指令,将所有未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延迟的块 I/O 和读写映射文件。否则在释放缓存的过程中,可能会丢失未保存的文件。
的值可以为0~3之间的任意数字,代表着不同的含义: 0 – 不释放 1 – 释放页缓存 2 – 释放dentries和inodes 3 – 释放所有缓存
[root@ok Desktop]# cat /proc/sys/vm/drop_caches
0
[root@ok Desktop]# file /proc/sys/vm/drop_caches
/proc/sys/vm/drop_caches: empty
[root@ok Desktop]# echo 1 >/proc/sys/vm/drop_caches
[root@ok Desktop]# free -h
total used free shared buffers cached
Mem: 11G 966M 10G 53M 392K 161M
-/+ buffers/cache: 804M 10G
Swap: 3.6G 0B 3.6G
查看内存条个数:
[root@ok Desktop]# dmidecode | grep -A16 "Memory Device$"
Memory Device
Array Handle: 0x0005
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 8192 MB
Form Factor: SODIMM
Set: None
Locator: ChannelA-DIMM0
Bank Locator: BANK 0
Type: DDR3
Type Detail: Synchronous
Speed: 1600 MHz
Manufacturer: Kingston
Serial Number: 7633D911
Asset Tag: None
Part Number: KHX1600C9S3L/8G
--
Memory Device
Array Handle: 0x0005
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: SODIMM
Set: None
Locator: ChannelB-DIMM0
Bank Locator: BANK 2
Type: DDR3
Type Detail: Synchronous
Speed: 1600 MHz
Manufacturer: Samsung
Serial Number: 20A9C496
Asset Tag: None
Part Number: M471B5173DB0-YK0
清除pagecache:
[root@ok ~]# sync
[root@ok ~]# sysctl -w vm.drop_caches=1
vm.drop_caches = 1
[root@ok ~]# free -h
total used free shared buffers cached
Mem: 11G 1.1G 10G 82M 412K 192M
-/+ buffers/cache: 980M 10G
Swap: 3.6G 0B 3.6G
清空 dentries 和 inodes:
[root@ok ~]# sync
[root@ok ~]# sysctl -w vm.drop_caches=2
vm.drop_caches = 2
[root@ok ~]# free -h
total used free shared buffers cached
Mem: 11G 1.2G 10G 79M 5.7M 224M
-/+ buffers/cache: 959M 10G
Swap: 3.6G 0B 3.6G
清空所有缓存 pagecache、dentries 和 inodes):
[root@ok ~]# sync
[root@ok ~]# sysctl -w vm.drop_caches=3
vm.drop_caches = 3
[root@ok ~]# free -h
total used free shared buffers cached
Mem: 11G 1.1G 10G 101M 1.5M 210M
-/+ buffers/cache: 956M 10G
Swap: 3.6G 0B 3.6G
linux 清内存的更多相关文章
- Linux的内存回收和交换
Linux的内存回收和交换 版权声明: 本文章内容在非商业使用前提下可无需授权任意转载.发布. 转载.发布请务必注明作者和其微博.微信公众号地址,以便读者询问问题和甄误反馈,共同进步. 微博ID:or ...
- 如何使用Linux命令行查看Linux服务器内存使用情况?
一个服务器,最重要的资源之一就是内存,内存够不够用,是直接关系到系统性能的关键所在. 本文介绍如何查看Linux服务器内存使用情况, 1.free命令 free -m [root@localhost ...
- Linux堆内存管理深入分析(下)
Linux堆内存管理深入分析 (下半部) 作者@走位,阿里聚安全 0 前言回顾 在上一篇文章中(链接见文章底部),详细介绍了堆内存管理中涉及到的基本概念以及相互关系,同时也着重介绍了堆中chunk分 ...
- Linux堆内存管理深入分析(上)
Linux堆内存管理深入分析(上半部) 作者:走位@阿里聚安全 0 前言 近年来,漏洞挖掘越来越火,各种漏洞挖掘.利用的分析文章层出不穷.从大方向来看,主要有基于栈溢出的漏洞利用和基于堆溢出的漏洞 ...
- Linux系统内存占用90%以上 ?
问题: [root@dbserver01 zx_epp_db]# free -m total used free shared buffers cached Mem: 15953 14706 1246 ...
- 【转】Linux查看内存大小和插槽
原文https://wsgzao.github.io/post/linux-memory/ Linux 查看内存的插槽数,已经使用多少插槽,每条内存多大,已使用内存多大 dmidecode | gre ...
- 关于Linux的内存(free -m)
查看Linux服务器下的内存使用情况,可以使用命令free -m.注意此命令只在Linux下有效,在FreeBSD中没有此命令.命令如下所示: used:已经使用的内存数 free:空闲的内存数 sh ...
- linux 查看内存的插槽数
[root@web ~]# dmidecode|grep -P -A5 "Memory\s+Device"| grep Size | grep -v Range #linux查看内 ...
- 【转】Linux 查看内存(free buffer cache)
转自:http://elf8848.iteye.com/blog/1995638 Linux下如何查内存信息,如内存总量.已使用量.可使用量.经常使用Windows操作系统的朋友,已经习惯了如果空闲的 ...
随机推荐
- Java编程兵书
<Java编程兵书> 基本信息 作者: 桂颖 任昱衡 丛书名: 程序员藏经阁 出版社:电子工业出版社 ISBN:9787121207419 上架时间:2013-8-26 出版日期:2013 ...
- OpenShift跨版本升级
官方的in-place upgrade直接在线升级的参考链接 https://docs.openshift.com/container-platform/3.11/upgrading/automate ...
- 如何获得Windows Server 2012上的FC的WWN
我有一个测试环境, 一对Host与storage array之间既有iSCSI的连接, 也有FC的连接. 原来iSCSI的连接是OK的, 现在需要转用FC. 当在光纤交换机上划好了Zone之后, st ...
- magento 自定义订单前缀或订单起始编号
在magento里订单的起始号是从1000000001开始的,但有时你可能需要自定义该值的起始号如从20000000000开始 在Google上搜索了一番找到以下代码并完美解决问题,以此记录希望帮助其 ...
- angularjs中ng-repeat的使用
第一个例子:使用ng-repeat最简单的例子 <html ng-app="myApp"> <head> <title>angularjs-de ...
- div浏览器兼容问题
1. 默认的内外边距不同 问题: 各个浏览器默认的内外边距不同 解决: *{margin:0;padding:0;} 2. 水平居中的问题 问题: 设置 text-align: center ie6- ...
- [Unity3D]Unity3D游戏开发之异步记载场景并实现进度条读取效果
大家好,我是秦元培.欢迎大家关注我的博客,我的博客地址是:blog.csdn.net/qinyuanpei.终于在各种无语的论文作业中解脱了,所以立即抓紧时间来这里更新博客.博主本来计划在Unity3 ...
- openerp创建动态视图-fields_view_get
openerp的视图结构是以XML的格式存放于ir.ui.view表中,属于静态格式,设计之后就固定, 但可以通过在model中重写fields_view_get函数,在视图加载时修改arch属性,动 ...
- WebApi2 知识点总结
1.建议使用异步接口async Task<> public async Task<IHttpActionResult> Get() 如果返回的是IEnumerable请使用: ...
- unix 网络编程 第七章
1 getsockopt和setsockopt函数 套接字选项粗分为两大基本类型:一是启用或禁止某个特性的二元选项,二是取得并返回特定值的选项,参数都是以指针形式传入的. 2 套接字状 ...