1

I have read What do the "buff/cache" and "avail mem" fields in top mean? and https://askubuntu.com/questions/770108/what-do-the-changes-in-free-output-from-14-04-to-16-04-mean. But still have questions.

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           7.7G        5.3G        268M        620M        2.1G        1.5G
Swap:           14G        874M         14G

Does "used" already include "shared"?

Can "available" be determined from other columns?

Why does "available" not equal to sum of "free" and "buff/cache"?

I thought that "buff/cache" is actually available to be used by starting a new process, so why is "available" smaller than "buff/cache"?

What columns does "total - used" (2.4G) consist of? Why isn't it the same as "available"?

Thanks.

4

See the free manpage for some answers; in particular:

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

The proc manpage is also worth reading (look at the /proc/meminfo description).

Addressing your questions:

Does "used" already include "shared"?

Yes.

Can "available" be determined from other columns?

No; see Meaning of "available" field in "free -m" command and How can I get the amount of available memory portably across distributions? for the (gory) details.

Why does "available" not equal to sum of "free" and "buff/cache"?

See above. It indicates the amount of memory which can be used without swapping; “buff/cache” includes memory which can’t immediately be reclaimed, and is therefore not available.

I thought that "buff/cache" is actually available to be used by starting a new process, so why is "available" smaller than "buff/cache"?

See above.

What columns does "total - used" (2.4G) consist of? Why isn't it the same as "available"?

See above.

  • Thanks. Do "total, free, used, buff/cache, avail mem" in top output mean the same as in free output? – Tim Oct 29 '18 at 14:19
  • Yes, they mean the same. – Stephen Kitt Oct 29 '18 at 14:22
  • Does "used" memory include kernel memory (which is also called "Wired memory" if I am correct)? I guess no, but kernel memory is mapped to the virtual address space of each process. – Tim Oct 29 '18 at 14:52
  • “used” includes some kernel allocations IIRC; the kernel binary isn’t accounted for there, it simply doesn’t appear in the total memory, but total memory doesn’t decrease when the kernel allocates more memory. The values we’re discussing here relate to physical memory, not the address space. – Stephen Kitt Oct 29 '18 at 15:14
  • Thanks. (1) "“used” includes some kernel allocations". Are those kernel allocation in user space or kernel space? What are they used for? (2) "the kernel binary isn’t accounted for there". so does the memory allocated for kernel data structures? – Tim Oct 29 '18 at 15:16

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.