8

I have a desktop system where Centos 7 is installed. It has 4 core and 12 GB memory. In order to find memory information I use free -h command. I have one confusion.

[user@xyz-hi ~]$ free -h
              total        used        free      shared  buff/cache   available
Mem:            11G        4.6G        231M         94M        6.8G        6.6G
Swap:          3.9G        104M        3.8G

In total column, It is saying that total in 11GB (that's correct), in last column available, it is saying that 6.6GB and used is 4.6G.

If used memory is 4.6GB then remaining should be 6.4 GB (11-4.6=6.4). What is correct interpretation of above output What is the difference between total and available and free memory? Am I out of memory is above case if I need 1 GB more for some new application?

  • so your question is about why it's 6.6 and not 6.4? – αԋɱҽԃ αмєяιcαη Dec 29 '17 at 5:14
  • 1
    this question goes back many decades .. How do you refer to memory currently used as cache, but is 'available or free'. ie. it contains data from the disk and thus is 'cache' if needed; but is available to apps should they malloc(). the difference you are worried about is useful to let us know how much memory is used by this 'where to put this value' and is debated every few years since the 80s. it isn't changed remaining as it always has been (the annoying.figure is useful! and being unchanged doesn't mean we have to modify decades old scripts that use it) – guiverc Dec 29 '17 at 5:20
9

man free command solve my problem.

DESCRIPTION
       free  displays the total amount of free and used physical and swap mem‐
       ory in the system, as well as the buffers and caches used by  the  ker‐
       nel.  The  information  is  gathered by parsing /proc/meminfo. The dis‐
       played columns are:

       total  Total installed memory (MemTotal and SwapTotal in /proc/meminfo)

       used   Used memory (calculated as total - free - buffers - cache)

       free   Unused memory (MemFree and SwapFree in /proc/meminfo)

       shared Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available
              on kernels 2.6.32, displayed as zero if not available)

       buffers
              Memory used by kernel buffers (Buffers in /proc/meminfo)

       cache  Memory  used  by  the  page  cache and slabs (Cached and Slab in
              /proc/meminfo)

       buff/cache
              Sum of buffers and cache

       available
              Estimation of how much memory  is  available  for  starting  new
              applications,  without swapping. Unlike the data provided by the
              cache or free fields, this field takes into account  page  cache
              and also that not all reclaimable memory slabs will be reclaimed
              due to items being in use (MemAvailable in /proc/meminfo, avail‐
              able on kernels 3.14, emulated on kernels 2.6.27+, otherwise the
              same as free)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.