linux 清内存
2016-07-22 23:38
441 查看
注意:首先我们需要使用sync指令,将所有未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延迟的块 I/O 和读写映射文件。否则在释放缓存的过程中,可能会丢失未保存的文件。
查看内存条个数:
清除pagecache:
清空 dentries 和 inodes:
清空所有缓存 pagecache、dentries 和 inodes):
的值可以为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
相关文章推荐
- VBOX环境搭建CentOS7虚拟机环境
- Mysql 5.7 Linux安装详细步骤
- 从零开始移植QT4.8.5之三--linux下交叉编译QT运行库
- Windows远程登录Linux
- centos7安装
- LINUX下SVN安装,配置,web目录同步(咋个办呢 zgbn)
- Linux nc命令详解
- Debian 更新 update 出现 没有公钥 的解决办法
- 对Linux目录和文件系统的理解
- 从零开始移植QT4.8.5之二--在linux下安装QT
- Linux基础 入门总结
- linux用户及组权限
- 【转载】信号量
- CentOS 上安装GCC GDB 和VIM 开发环境
- Linux文件处理命令
- linux下用mii-tool和ethtool 查看网线是否正确连接到网卡
- 利用pxe和kickstart批量安装Linux客户端CentOS6.5
- Linux下修改文件的时间属性
- 解决linux下解压来自windows的zip文件产生乱码的问题
- 简单的linux命令