WittCode💻

Linux How To Check For Low Memory

By

Learn how to check if a Linux system has low memory. We will discuss if low free memory is bad, what swap is, and free vs available memory.

Table of Contents 📖

What is Free Memory?

When checking if a Linux system has low memory, a common place people look for is low free memory. Free memory is memory that is free to be used by other processes. We can see a system's free memory using the free command.

free -h
              total        used        free      shared  buff/cache   available
Mem:           1.0G        351M        9.1M         11M        663M        661M
Swap:          256M         12M        243M

INFO: The -h flag makes the output human readable.

Here we have roughly 9.1MB of free memory which is pretty low.

Is Low Free Memory Bad?

Having only 9.1 MB out of 1 GB total of RAM looks as if our system is at 99% memory usage, possibly leading to a slow system. However, this isn't necessarily the case. Free memory doesn't speed up a system or processes, it just sits there. If we look at the available memory, we can see that it is 661 MB or roughly 66% of total memory.

SUCCESS: Available memory is the amount of free memory plus the memory currently in use that can be reclaimed when needed or allocated to a new/existing process.

This means that about 66% of our memory is ready to be allocated to new or existing processes.

Is Low Free Memory a Waste?

Some people think of free RAM as wasted RAM. Some people get triggered by large RAM usage by applications, referring to them as "memory hogs". They want to see a higher free RAM that can be used by other applications.

Low Memory Indicators

Nevertheless, there are better low memory indicators out there than free memory. As opposed to checking for low free memory, check for fluctuations in swap memory and low available memory. Swap is a mechanism that allows computers to use extra memory by creating a file/partition on a storage volume. This creates a backup option when the sytem's physical memory is full.