Linux free显示高内存使用率但top不显示

Dar*_*Var 59 linux redhat memory-management process free-command

在RedHat Linux 6.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
Run Code Online (Sandbox Code Playgroud)

但同时在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
Run Code Online (Sandbox Code Playgroud)

我也试过这个ps mem脚本,但是它显示了大约400MB的内存被使用.

cdh*_*wie 111

不要看"Mem"行,看看它下面的那一行.

Linux内核消耗尽可能多的内存来提供I/O缓存(以及其他非关键缓冲区,但缓存将是这种用法的大部分).当它们请求时,该存储器被放弃到进程.的" - /+缓冲器/高速缓存"行是显示您的调整值的I/O高速缓冲存储器占后,即,存储器由工艺和可用于进程的量(在这种情况下的使用量,使用578MB和7411MB免费).

" - /+缓存/缓存"使用的内存的"纪念品"和之间的差异行显示你有多少在使用内核缓存的目的:7734MB - 578MB = 7156MB在I/O缓存.如果进程需要这个内存,内核将简单地缩小I/O缓存的大小.


Gna*_*ana 14

另外,如第一行所示 total used free shared buffers cached Mem: 7989 7734 254 0 28 7128 -/+ buffers/cache: 578 7411

如果我们添加(缓存[7128] + buffers [28] + free [254]),我们将获得大约第二行的free [7411]值 7128 + 28 + 254 = 7410