5

I would appreciate help in interpreting the output of 'free -m' below.

-bash-4.2$ free -m
              total        used        free      shared  buff/cache   available
Mem:          15793        7112          88        7840        8591         611
Swap:         16891        5289       11602
  1. If I have nearly 11GB free then why am I seeing swap usage. Shouldn't that be 0?
  2. Also, the 'shared' value is 7840. Is this memory available for a new application?
  3. Is only 'cache' memory available for new applications? In other words, 'shared' and 'buffer' memory are not available for new applications?
  4. How should I interpret the 'available' column with a value of 611? How is this value arrived at?
muru
  • 197,895
  • 55
  • 485
  • 740

2 Answers2

4

It says, your swap area is 16891 MBs. You allocated 5289 MBs, and there are 11602 MBs free swap area. Total = Used + Free

Shared: Memory used (mostly) by tmpfs (Shmem in /proc/meminfo)

Buffers: Memory used by kernel buffers (Buffers in /proc/meminfo)

Cache: Memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo)

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.

You can read more with command man free

  1. You have 11GB free swap area, not memory, so you should see 5289 MB swap usage.
  2. Memory available for new application is 611 MBs, as you can see under available column.
  3. No, only available column shows available memory for applications.
  4. See previous answer

Edit: Found a topic about recent change in free command. Can be useful.

ferit
  • 258
0

Short answer to the question... if your free -m output is typical when you're running normally... you're running out of RAM, started to use 30%+ swap space, and the system will start to slow down, as disk (swap) speed is slower than real RAM speed. Slower system, and more disk I/O.

Yes... you could use more memory. Adding memory mostly depends on two things... how much RAM your motherboard will take... and how much money you can spend on more RAM.

There is a system parameter called vm.swappiness that sets up how RAM vs swap is used, but some might argue about how to set it. That's for another discussion, but you can search here on AU to see the conversations.

Your current swap setting of 16G is fine, even if you add more memory.

heynnema
  • 70,711