我的Ubuntu比任务管理器显示的内存更多:
原文链接:https://www.f2er.com/ubuntu/348682.htmlsudo ps -e --format RSS | awk 'BEGIN{c=0} {c+=$1} END{print c/1024}' 2750.29 free -m total used free shared buffers cached Mem: 3860 2765 1094 0 3 300 -/+ buffers/cache: 2461 1398 Swap: 2729 2374 354
真奇怪.有人可以解释这种差异吗?
但更重要的是:
我想知道一个进程真正使用了多少内存.我不想知道虚拟内存大小,而是驻留内存加上进程的交换.
我也尝试输出’ps’的格式参数“sz”,但是它的总和是高(16000 MB)(参数’size’给出36700 MB).还有其他选择吗?
我真的想用这个,来确定哪些程序/进程正在吃多少内存(和交换),杀死它们,因为内存很有价值:-)这真的没有意义,所以我在这里问.
/ proc / meminfo的输出:
MemTotal: 3952812 kB MemFree: 1119192 kB Buffers: 2676 kB Cached: 290068 kB SwapCached: 160980 kB Active: 1805396 kB Inactive: 731680 kB Active(anon): 1745820 kB Inactive(anon): 689184 kB Active(file): 59576 kB Inactive(file): 42496 kB Unevictable: 148 kB Mlocked: 148 kB SwapTotal: 2795272 kB SwapFree: 390900 kB Dirty: 1984 kB Writeback: 0 kB AnonPages: 2085472 kB Mapped: 67432 kB Shmem: 190676 kB Slab: 88012 kB SReclaimable: 42704 kB SUnreclaim: 45308 kB KernelStack: 5496 kB PageTables: 87860 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 4771676 kB Committed_AS: 9522364 kB VmallocTotal: 34359738367 kB VmallocUsed: 374404 kB VmallocChunk: 34359330144 kB HardwareCorrupted: 0 kB AnonHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 61440 kB DirectMap2M: 4030464 kB