//! `mem_free` | Free memory not yet used by the kernel or userspace (in general you should use mem_avail)
//! `mem_free_percents` | as above but as a percentage of total memory
//! `mem_avail` | Kernel estimate of usable free memory which includes cached memory and buffers
//! `mem_avail_percents` | as above but as a percentage of total memory
//! `mem_total_used` | mem_total - mem_free
//! `mem_total_used_percents` | as above but as a percentage of total memory
//! `mem_used` | Memory used, excluding cached memory and buffers; same as htop's green bar
//! `mem_used_percents` | as above but as a percentage of total memory
mem_used is the used memory, but it excludes buffers. this green bar in htop does not include 'buffers/shared memory', which means it's not what free actually reports for used, which is the opposite of mem_avail.
for example the following:
free:
$ free
total used free shared buff/cache available
Mem: 32799040 22935160 1896944 12413232 20856892 9863880
Swap: 18874360 9843712 9030648
but in mem_used_percents, this is seen as 30%, even though it should be more like 65%+. this is because it presumably excludes shared memory from the calculation?
it would be nice if either it took that into account, or there was a new value that was just 1 - mem_avail_percents
if you want to test this yourself, you can easily force a large shared memory allocation by placing a huge file into tmpfs, e.g. fallocate -l 10G /tmp/bigfile. these usages are what is missing in mem_used even though they are actually used
the memory block has the following values:
mem_used
is the used memory, but it excludes buffers. this green bar in htop does not include 'buffers/shared memory', which means it's not whatfree
actually reports forused
, which is the opposite ofmem_avail
.for example the following:![](https://img.ayaya.dev/aI5lyELE361e)
free:
but in
mem_used_percents
, this is seen as30%
, even though it should be more like 65%+. this is because it presumably excludes shared memory from the calculation?it would be nice if either it took that into account, or there was a new value that was just
1 - mem_avail_percents
if you want to test this yourself, you can easily force a large shared memory allocation by placing a huge file into tmpfs, e.g.
fallocate -l 10G /tmp/bigfile
. these usages are what is missing in mem_used even though they are actually used