Linux 释放内存方法
2012-08-27 09:34
671 查看
[root@node1 ~]# free -m
total used free shared buffers cached
Mem: 8004 6557 1446 0 163 5630
-/+ buffers/cache: 763 7240
Swap: 1983 0 1983
其中:
total 内存总数
used 已经使用的内存数
free 空闲的内存数
shared 多个进程共享的内存总额
buffers Buffer Cache和cached Page Cache 磁盘缓存的大小
-buffers/cache 的内存数:used - buffers - cached
+buffers/cache 的内存数:free + buffers + cached
可用的memory=free memory+buffers+cached
把内存里的数据暂时写到硬盘里
[root@node1 ~]# sync
修改 /proc/sys/vm/drop_caches文件(/proc/sys/vm/drop_caches的默认值为0)
[root@node1 ~]# echo 3 > /proc/sys/vm/drop_caches
[root@node1 ~]# cat /proc/sys/vm/drop_caches
再看内存
[root@node1 ~]# free -m
total used free shared buffers cached
Mem: 8004 631 7372 0 0 60
-/+ buffers/cache: 570 7433
Swap: 1983 0 1983
终于释放出来了。
有关/proc/sys/vm/drop_caches的用法在下面进行了说明(原文:http://www.linuxinsight.com/proc_sys_vm_drop_caches.html):
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
This tunable was added in 2.6.16.
total used free shared buffers cached
Mem: 8004 6557 1446 0 163 5630
-/+ buffers/cache: 763 7240
Swap: 1983 0 1983
其中:
total 内存总数
used 已经使用的内存数
free 空闲的内存数
shared 多个进程共享的内存总额
buffers Buffer Cache和cached Page Cache 磁盘缓存的大小
-buffers/cache 的内存数:used - buffers - cached
+buffers/cache 的内存数:free + buffers + cached
可用的memory=free memory+buffers+cached
把内存里的数据暂时写到硬盘里
[root@node1 ~]# sync
修改 /proc/sys/vm/drop_caches文件(/proc/sys/vm/drop_caches的默认值为0)
[root@node1 ~]# echo 3 > /proc/sys/vm/drop_caches
[root@node1 ~]# cat /proc/sys/vm/drop_caches
再看内存
[root@node1 ~]# free -m
total used free shared buffers cached
Mem: 8004 631 7372 0 0 60
-/+ buffers/cache: 570 7433
Swap: 1983 0 1983
终于释放出来了。
有关/proc/sys/vm/drop_caches的用法在下面进行了说明(原文:http://www.linuxinsight.com/proc_sys_vm_drop_caches.html):
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
This tunable was added in 2.6.16.
相关文章推荐
- Linux 释放内存方法
- 如何手动释放Linux内存的方法
- [转帖][实用]Linux 释放内存方法
- linux 手工释放内存 高内存 内存回收 方法思路
- linux释放内存的方法
- linux结束程序内存不会马上释放的解决方法
- CentOS7(Linux)清理yum缓存 和释放内存方法
- Linux 释放内存方法
- linux释放内存方法
- 如何手动释放Linux内存的方法
- linux手动释放内存的方法
- Linux 释放内存方法
- 如何手动释放Linux内存的方法
- 如何手动释放Linux内存的方法
- 简单介绍Linux内存手动释放方法
- 嵌入式 如何手动释放Linux内存的方法
- Linux 释放内存方法
- Linux 释放内存方法
- CentOS7(Linux)清理yum缓存 和释放内存方法
- Linux内存手动释放方法