在RedHat Linux6.2上,我运行的是free -m
,它显示了几乎所有使用的8GB
total used free shared buffers cached
Mem: 7989 7734 254 0 28 7128
-/+ buffers/cache: 578 7411
Swap: 4150 0 4150
但同时在top -M
中,我看不到任何进程在使用所有这些内存:
top - 16:03:34 up 4:10, 2 users, load average: 0.08, 0.04, 0.01
Tasks: 169 total, 1 running, 163 sleeping, 5 stopped, 0 zombie
Cpu(s): 0.7%us, 0.3%sy, 0.0%ni, 98.6%id, 0.4%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 7989.539M total, 7721.570M used, 267.969M free, 28.633M buffers
Swap: 4150.992M total, 0.000k used, 4150.992M free, 7115.312M cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1863 sroot 20 0 398m 24m 9.8m S 0.3 0.3 3:12.87 App1
1 sroot 20 0 2864 1392 1180 S 0.0 0.0 0:00.91 init
2 sroot 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 sroot RT 0 0 0 0 S 0.0 0.0 0:00.07 migration/0
4 sroot 20 0 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
5 sroot RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 sroot RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
7 sroot RT 0 0 0 0 S 0.0 0.0 0:00.08 migration/1
8 sroot RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
我也尝试过这个ps mem script,但它只显示使用了大约400MB内存。
发布于 2013-07-12 23:46:49
不要看"Mem“行,要看它下面的那行。
Linux内核消耗尽可能多的内存来提供I/O缓存(和其他非关键缓冲区,但缓存将是这种使用的主要部分)。当进程请求它时,该内存被释放给它们。"-/+ buffers/ cache“行显示了计入I/O缓存后的调整值,即进程使用的内存量和进程可用的内存量(在本例中,已用内存为578MB,可用内存为7411MB )。
"Mem“和"-/+ buffers/ cache”行之间的已用内存差异显示内核使用了多少内存用于缓存: I/O缓存中的7734MB - 578MB = 7156MB。如果进程需要这个内存,内核将简单地缩小I/O缓存的大小。
发布于 2014-11-19 01:08:11
此外,正如第一行所示的total used free shared buffers cached Mem: 7989 7734 254 0 28 7128 -/+ buffers/cache: 578 7411
如果我们添加(cached7128 + buffers28 + free254),我们将得到大约第二行的free7411值7128 + 28 + 254 = 7410
发布于 2019-07-02 15:58:06
如果缓存较小,请尝试执行以下命令:
ps aux --sort -rss
https://stackoverflow.com/questions/17618737
复制相似问题