Difference between available and free memory


I have updated my postgres app from 256mb ram to 512mb, but here it shows available memory as 99mb. What does it mean? is the remaining free memory usable by the app?

I found this answer in an old question:

The old query used fly_instance_memory_mem_free , which only reported entirely free/unused memory, while the updated query (matching the one in the Grafana dashboard) uses fly_instance_memory_mem_available , which reports ‘available’ memory, that doesn’t include memory used for filesystem cache/buffers that is nonetheless available for application use when needed. This gives a generally better approximation of memory usage for a simple overview.

For the ‘Memory - Basic’ graph, the Free amount is entirely un-allocated memory, while the Available amount is the kernel’s estimate of additional memory currently allocated to temporary buffers, filesystem caches and so on, that’s still usable (‘reclaimable’) by the app if needed.

See the kernel documentation:

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.

The ‘Available’ amount on the graph is actually MemAvailable - MemFree because the ‘Free’ amount is already displayed separately.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.