-1
free -m 
             total       used       free     shared    buffers     cached
Mem:          7974       6993        981          0        557        893
-/+ buffers/cache:       5542       2432
Swap:         2047          0       2047

You see that my system has used 5542MB memory, but when I use ps aux to check who uses it, I couldn't figure out.

ps aux | awk '$6 > 0{print $3, $4, $5, $6}'
%CPU %MEM VSZ RSS
0.0 0.0 10344 700
0.0 0.0 51172 2092
0.0 0.0 51172 1032
0.0 0.0 68296 1600
0.0 0.0 12692 872
0.0 0.0 33840 864
0.0 0.0 10728 376
0.0 0.0 8564 648
0.0 0.0 74856 1132
53.2 0.5 930408 45824
0.0 0.0 24236 1768
0.0 0.0 51172 2100
0.0 0.0 51172 1040
0.0 0.0 68296 1600
51.9 0.5 864348 42740
0.0 0.0 34360 2672
0.0 0.0 3784 528
0.0 0.0 3784 532
0.0 0.0 3784 528
0.0 0.0 3784 528
0.0 0.0 3784 532
0.0 0.0 65604 900
0.0 0.0 63916 832
0.0 0.0 94020 5980
0.0 0.0 3836 468
0.0 0.0 93736 4000
0.0 0.0 3788 484
0.0 0.0 3652 336
0.0 0.0 3652 336
0.0 0.0 3684 344
0.0 0.0 3664 324
0.0 0.0 19184 4880
0.0 0.0 3704 324
0.0 0.0 340176 1312
0.0 0.0 46544 816
0.0 0.0 10792 1092
0.0 0.0 3824 400
0.0 0.0 3640 292
0.0 0.0 3652 332
0.0 0.0 3652 332
0.0 0.0 3664 328
0.0 0.0 4264 1004
0.0 0.0 4584 2368
0.0 0.0 77724 3060
0.0 0.0 89280 2704

you see, that the sum of RSS is 152.484MB, the sum of VSZ is 3376.34MB, so I don't know who eat up the rest of the memory, the kernel?

Zhenyu Li
  • 655
  • 1
  • 6
  • 11

1 Answers1

2

From my system:

$ grep ^S[^wh] /proc/meminfo 
Slab:            4707412 kB
SReclaimable:    4602900 kB
SUnreclaim:       104512 kB

These three metrics are data structures held by the slab alocator. While SUnreclaimable is, well, unreclaimable, SReclaimable is just like any other cache in the system - it will be made available to processes under memory pressure. Unfortunately free does not seem to take it into account, as mentioned in detail in this older answer of mine, and this part of memory can easily grow to several GB of memory...

If you really want to see how much memory your processes are using you could try going through the cache-emptying procedure described in my post - you can skip the swap-related parts, since your system does not appear to be using any swap memory anyway.

Community
  • 1
  • 1
thkala
  • 84,049
  • 23
  • 157
  • 201
  • thanks for your answer, and when i use slabtop to check which find dentry_cache has 2000w objects, and then I remove the cache, seems every thing is ok. – Zhenyu Li Jan 07 '13 at 09:30