What is available and free memory in response of free command on Linux?

29,849

Modern operating systems go out of their way to keep as little memory free as possible. Memory that is free is actually harder to use because it has to be transitioned from free to in use. Memory that is already in use, that is, memory that is available but not free, can easily be switched to another use.

All this is normal. Free memory is wasted and does not make your system faster.

If you're thinking "but I want my memory free now so I can use it later", realize that this makes no sense. You can't save memory for later. A system with 4GB that uses 2GB today can't use 6GB tomorrow. You can use your memory both now and later. There is no tradeoff here -- using memory is free. The only alternative to using memory is wasting it. Why would you want your system to waste more memory?

Share:
29,849
Nishant Lakhara
Author by

Nishant Lakhara

Enthusiastic and Skilled Java Developer with 8+ years of experience developing highly available, scalable applications across the Java/Spring stack. Collaborates with Leads and end-users to create functionalities that align with the requirements.

Updated on September 25, 2020

Comments

  • Nishant Lakhara
    Nishant Lakhara over 3 years

    The output of the free command that I fired on my Linux host is as below:

    free
                  total        used        free      shared  buff/cache   available
    Mem:      263846320    47746620     3290072     1140808   212809628   214382420
    Swap:             0           0           0
    

    I am not able to figure out what this available part is specifying. The free memory is very less shown i.e around 1.24% even though the total memory is way high and used memory is around 18.09% only.

    free -h
                  total        used        free      shared  buff/cache   available
    Mem:           251G         45G        3.1G        1.1G        202G        204G
    Swap:            0B          0B          0B
    

    Does it mean I won't be able to start more applications as free memory is very less? The used memory is 18% only. So shouldn't free memory be 82% and not 1.24% as the command is showing above?

    I am confused. Can anyone help?