I try to rearrange the expression to make it more clear:
A = B + C = G + H
G = B - E - F
H = C + E + F
It seems that:
Mem: 1034332 983572 50760 0 149028 530132
shows "buffers" and "cached" as part of "used" memory.
But -/+ buffers/cache: 304412 729920
shows "buffers" and "cached" as part of "free" memory
The -/+ buffers/cache line shows how much memory is used and free from the perspective of the applications. --- from http://gentoo-wiki.com/FAQ_Linux_Memory_Management#The_difference_between_buffers_and_cache
And I do a test on my box, it shows that when the "free" memory is going to be exhausted,
the kernel will take back all the "buffers" memory, but still left some "cached"memory. Following is the output by "free -m -s 1" when I increasingly created threads to consume the memory:
total used free shared buffers cac
+hed
Mem: 7973 68 7904 0 8
+ 27
-/+ buffers/cache: 33 7939
Swap: 2047 0 2047
total used free shared buffers cac
+hed
Mem: 7973 106 7866 0 8
+ 27
-/+ buffers/cache: 71 7902
Swap: 2047 0 2047
|