更新:
这是由于nss-softkn的一个已知问题引起的。 看到这篇文章: https : //www.splyt.com/blog/2014-05-16-optimizing-aws-nss-softoken
当我从我的centos 6.5盒子里运行免费的-m时,我看到我只有1400MB的可用内存,包括caching。 当我做到最高,按内存sorting,并加上我只看到1600左右正在使用的过程。 我应该有一个更多的自由记忆。 这发生在我们的几个盒子上。
[root@db1 ~]# free -m total used free shared buffers cached Mem: 7840 7793 47 0 287 1357 -/+ buffers/cache: 6148 1692 Swap: 7983 7 7976
顶级输出

这是一个更好的方式来可视化进程消耗的内存:

根据Linux,你有1692m的空闲内存。
在最高的“Mem”行中,您的内存看起来好像是99%(7793m / 7840m),但实际上您只能使用大约78%的可用内存。 另请参阅http://www.linuxatemyram.com/以获得更深入的解释。
免费vs Top vs / proc / meminfo
进程内存 。
将进程使用的内存加在top并试图将这个内存与free使用的内存匹配,这会给你一个不好的时间。 由于top分页,你甚至可能不会得到这个列表中的所有进程,更好的方法是使用ps aux --sort -rss来按内存使用来sorting进程。
磁盘caching 。
Linux将使用你没有使用的内存来为你在后台运行速度更快。 这是在free的“caching”列中注明的,也是为什么你应该看看“ – / +缓冲区/caching”旁边的值为实际使用和空闲内存。
内核板caching 。
内核模块和驱动程序也可以使用未使用的内存。 “SReclaimable”是可以在内存压力下使用的内存。 有一个叫做slabtop的很酷的工具,可以确定内核是如何被caching的。
清除caching 。
echo 1 > /proc/sys/vm/drop_caches释放页面caching
echo 2 > /proc/sys/vm/drop_caches释放dentries和inode
echo 3 > /proc/sys/vm/drop_caches释放pagecache,dentries和inode
也可以看看
我在这里find了问题。 我需要看看/ proc / meminfo,看看内核caching为slab空间。 我的问题是不知道有多less“免费”的内存顶部/ PS /免费说我有。 事实上,这些数字没有加起来。 “免费”的命令会告诉我,我有大约1692mb免费,但我的进程只占总内存的20%左右。
本文介绍了我的确切问题:
http://blog.logicmonitor.com/2014/10/09/more-linux-memory-free-memory-that-is-not-free-nor-cache/
我相信你误读缓冲区/caching – 根据+/-缓冲区/caching行,有6个演出用作内存caching。 如果需要,可以将其用于 – 作为它的不是,操作系统正在使用它来caching磁盘读取和类似的。
基于http://blog.logicmonitor.com/2014/10/09/more-linux-memory-free-memory-that-is-not-free-nor-cache ,我创build了一个我称为free的脚本我放在我的.bash_profile的/ usr / bin之前的path),产生有用的结果:
#!/usr/bin/perl $result = `/usr/bin/free`; print "$result"; if ($result =~ /cache:\s+(\d+)/) { $mem = $1; $slab = `cat /proc/meminfo|grep SReclaimable`; $slab =~ s/[^\d]//g; print "Slab $slab\n"; print "Actual Used ** ",$mem-$slab," **\n"; }