Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux "free -m": Total, used and free memory values don't add up [closed]

Tags:

On a linux system, while using "free", following are the values:

         total      used      free    shared  buff/cache   available Mem:  26755612    873224    389320    286944    25493068    25311948 Swap:        0         0         0 

The total, used and free values don't add up. I'm expecting total = used + free.

Question: What am I missing here?

like image 670
Michael Massey Avatar asked Jun 11 '15 05:06

Michael Massey


People also ask

What does free M means in Linux?

Displaying RAM in different format By default, free command displays RAM information in kb format. You can display it in different format as per your wish. Syntax: free -b display information in Bytes. free -m display information in Megabytes.


1 Answers

For the main memory, the actual size of memory can be calculated as used+free+buffers+cache OR used+free+buffers/cache because buffers/cache = buffer+cache.

The man page of free highlights used as Used memory (calculated as total - free - buffers - cache)

As the man page of free says :-

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, 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, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free)

In your case,


873224(used) + 389320(free) + 25493068(buff/cache) = 26755612(total)


like image 106
Am_I_Helpful Avatar answered Sep 29 '22 17:09

Am_I_Helpful