Please consider the sample output I got from the free
command in my Ubuntu 12.04
:
total used free shared buffers cached
Mem: 8074640 6187480 1887160 377056 365128 2113156
-/+ buffers/cache: 3709196 4365444
Swap: 15998972 82120 15916852
The Mem used
(kb_main_used) field value is now calculated like this:
used = total - free - cached - buffers
Previously, it used to be:
used = total - free
This change was introduced in the following commit https://gitlab.com/procps-ng/procps/commit/6cb75efef85f735b72e6c96f197f358f511f8ed9
An intermediate value:
buffers_plus_cached = buffers (kb_main_buffers) + cached (kb_main_cached) = 365128 + 2113156 = 2478284
+/- buffers/cache value is calculated like this:
buffers = kb_main_used - buffers_plus_cached = 6187480 - 2478284 = 3709196
/
cache = kb_main_free + buffers_plus_cached = 1887160 + 2478284 = 4365444
The new buff/cache value is calculates like this:
buff/cache = kb_main_buffers+kb_main_cached = 365128 + 2113156 = 2478284
This is the same as the buffers_plus_cached
, used in previous versions, the difference is that previously it was used internally, and now its displayed directly, and the further calculated line, -/+ buffers/cache
has been removed
For more info, please check these commits, where these changes were introduced:
https://gitlab.com/procps-ng/procps/commit/f47001c9e91a1e9b12db4497051a212cf49a87b1
https://gitlab.com/procps-ng/procps/commit/c9908b59712d1afd6b9bf7971ba1d8900ae5adb8
As of the new available
field, for Linux kernels older than 2.6.27, its value is the same as the free
value, but for the later versions of the Kernel, its a bit different:
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,
available on kernels 3.14, emulated on kernels 2.6.27+,
otherwise the same as free)
Courtesy:
http://manpages.ubuntu.com/manpages/xenial/en/man1/free.1.html
So, the specific answer to your questions would be:
- The new version of
free
includes buffers/cache in the calculations of Mem used/free
values.
- The
+/- buffers/cache
value that used to be there in previous versions of free
is now available as:
- -/+ buffers/cache
used
= Current Mem used
column (Its calculation is detailed above)
- -/+ buffers/cache
free
is available as the more accurate value in the current new column available
N.B: The kb_*
variable names are the internal names used in the source code.
It says, your swap area is 16891 MBs. You allocated 5289 MBs, and there are 11602 MBs free swap area. Total = Used + Free
Shared: Memory used (mostly) by tmpfs (Shmem in /proc/meminfo)
Buffers: Memory used by kernel buffers (Buffers in /proc/meminfo)
Cache: Memory used by the page cache and slabs (Cached and SReclaimable
in /proc/meminfo)
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.
You can read more with command man free
- You have 11GB free swap area, not memory, so you should see 5289 MB swap usage.
- Memory available for new application is 611 MBs, as you can see under available column.
- No, only available column shows available memory for applications.
- See previous answer
Edit: Found a topic about recent change in free
command. Can be useful.
Best Answer
You have 112 MB of completely free memory, BUT the 501 mb you see is without 'cached' memory. This means that the OS has put some stuff in your memory to be quicker. It calls this "used" (therefore your 'free' number is only 112), but it is actually available for you if you need it.
This is a good thing, because unused memory is useless memory. The cached memory can be cleared if needed. The old "I need to clean up memory" stuff people used to do for windows 95 isn't needed here: it's all fine and happy :)
The number you are looking for is 501 free (in megabytes because of
-m
).see for reference these pages:
http://www.linuxatemyram.com/
http://www.itworld.com/it-managementstrategy/280695/making-sense-memory-usage-linux