3

I'm using CentOS 7, I find my available memory is less than free memory, but why?

root@localhost:~# free -h
              total        used        free      shared  buff/cache   available
Mem:           251G        1.9G        249G        9.2M        260M        248G
Swap:           64M         49M         14M

There is a same problem, but the answer did not explain why the available is less than free, it is just talk about the cache.

why centos7 free command output available value less than free value

  • 1
    The answer is unclear but still correct your question is the exact duplicate. The os Will use ram as cache as long as it doesnt need to free it – Kiwy Apr 26 '18 at 11:59
  • 3
    Possible duplicate of why centos7 free command output available value less than free value – Kiwy Apr 26 '18 at 12:00
  • @Kiwy but cache is accounted for separately – Stephen Kitt Apr 26 '18 at 12:23
  • @StephenKitt indeed you're right. should read those question from my phone – Kiwy Apr 26 '18 at 12:26
  • 1
    I agree this is a duplicate, but the question it is a duplicate of has no valid answer (the one that is there is wrong). The close vote specifically says "This question has been asked before and already has an answer.", so not sure whether to vote close or not :-/ – Patrick Apr 26 '18 at 12:43
0

The available memory is just a estimate of how memory can be really used in your system for loading programs, so it is not a precise value.

As you probably already knows the normal behavior is to have the available memory bigger than the free memory, but in your case the opposite occurs, because the statistics used to calculate this estimated value will be helped by greater cache/buffers values, but they are penalized in your system because you dont have high cache or buffers, and because all the other things it takes into negative account, your available memory will get greater negative impact... so it is probably underestimated, as it will consider that this percentage of all your free memory, will be necessary for a lot of other things than simple loading programs (specially when you load programs - system will need more and more memory to store informations about the processes and much more - also like having a reasonable value of caches and buffers......).

From github:

MemAvailable: An estimate of how much memory is available for starting new applications, without swapping. Calculated from MemFree, SReclaimable, the size of the file LRU lists, and the low watermarks in each zone. The estimate takes into account that the system needs some page cache to function well, and that not all reclaimable slab will be reclaimable, due to items being in use. The impact of those factors will vary from system to system. To get a more detailed answer, you will need to post the contents of your /proc/meminfo.

  • What would cause available to be just 1GB while free is 5.7GB? – Richlv Sep 7 '18 at 6:30
1

If you read the CentOS 7 man page on free, it explains that the available field takes into account that not all reclaimable memory will be reclaimed due to some items being in use (memory available to the kernel, for example), unlike the cache and free fields. I believe that this could be the cause of the differences you're seeing.

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)

  • What would cause available to be just 1GB while free is 5.7GB? – Richlv Sep 7 '18 at 6:30

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.