how to explain free buffers and cached memory usage

 free -m
                   total       used       free     shared    buffers     cached
Mem:         48269       2424      45845          0        139       1120
-/+ buffers/cache:       1164      47105
Swap:         8197          0           8197

                   total       used       free     shared    buffers     cached
Mem:           A             B            C            D             E              F
-/+ buffers/cache:      G            H
Swap:         I              J             K

Note:

A=B+C

A=G+H

G=B-E-F

H=C+E+F

The display columns mean:

  • total: Your total (physical) RAM (excluding a small bit that the kernel permanently reserves for itself at startup); that's why it shows ca. 11.7 GiB , and not 12 GiB, which you probably have
  • use: memory in use by the OS
  • free: memory not in use

total=use+free

  • shared/buffers/cached: This shows memory usage for specific purposes; the numbers are included in the value for "use". This is why the second line gives the numbers for used/free minus the sum cached+buffers.

The first line is about your physical memory (RAM), the last line "swap" gives the same information about swap space usage (i.e. memory contents that have been temporarily moved to disk). The second line gives the numbers for used/free minus the sum cached+buffers (because that value is often more meaningful).

To actually understand what the numbers mean, you need a bit of background about the virtual memory (VM) subsystem in Linux. Just a short version: Linux (like most modern OS) will always try to use free RAM for caching stuff, so "free" will almost always be very low. Therefore the line "/+ buffers/cache:" is shown, because it shows how much memory is free when ignoring caches; caches will be freed automatically if memory gets scarce, so they do not really matter.

A Linux system is really low on memory if the free value in "/+ buffers/cache:" gets low.

For more details about the meaning of the numbers, see e.g. the questions:

http://serverfault.com/questions/23433/in-linux-what-is-the-difference-between-buffers-and-cache-reported-by-the-fr

http://serverfault.com/questions/9442/why-does-red-hat-linux-report-less-free-memory-on-the-system-than-is-actually-ava

猜你喜欢

转载自standalone.iteye.com/blog/1126856