我运行了一些命令(在脚本中快速)并得到了这个:
$ ps -A | wc -l
513
$ echo "$((`ps -A -o rss |tr "\n" +`0))"
4368208
$ free
total used free shared buff/cache available
Mem: 5993608 5157844 132848 42616 702916 519028
Swap: 21030892 5276136 15754756
$ cat /proc/meminfo
MemTotal: 5993608 kB
MemFree: 132996 kB
MemAvailable: 519176 kB
Buffers: 83384 kB
Cached: 514368 kB
SwapCached: 422808 kB
Active: 392060 kB
Inactive: 1572336 kB
Active(anon): 106632 kB
Inactive(anon): 1312656 kB
Active(file): 285428 kB
Inactive(file): 259680 kB
Unevictable: 27084 kB
Mlocked: 27084 kB
SwapTotal: 21030892 kB
SwapFree: 15754756 kB
Dirty: 264 kB
Writeback: 0 kB
AnonPages: 1190852 kB
Mapped: 1107036 kB
Shmem: 42616 kB
KReclaimable: 105164 kB
Slab: 291468 kB
SReclaimable: 105164 kB
SUnreclaim: 186304 kB
KernelStack: 19376 kB
PageTables: 58636 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 24027696 kB
Committed_AS: 14543756 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 117308 kB
VmallocChunk: 0 kB
Percpu: 7072 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
FileHugePages: 0 kB
FilePmdMapped: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 5936768 kB
DirectMap2M: 335872 kB
DirectMap1G: 0 kB
789636 kB (5157844-4368208) 去哪儿了?
我的最终目标是确定什么正在使用该 RAM,以及是否可以释放它。
如果可能的话,我需要能够列出正在使用该 RAM 的内容。
有更好的ps
命令参数吗?
内核本身使用了一些内存,但大部分都在 702,916k 的缓冲区/缓存中。