Why is Linux using so much RAM?

Because it can (and should)

Why is Linux using so much RAM?
Photo by Gabriel Heinzer / Unsplash

I almost forgot about this and thought I’d write it down as it bears repeating:

Linux repurposes unused memory for disk caching. When looking at output for free, this can confuse admins who aren’t familiar with this practice.

For a thorough and fantastic explanation, check out LinuxAteMyRam.com.

One additional thing that’s worth noting – depending on the age of the OS you’re looking at, the output of free may have different info:

$ free -m
              total        used        free      shared  buff/cache   available
Mem:           1504        1491          13           0         855      792
Swap:          2047           6        2041

(code excerpts might look a little wonky via email. Check this post on hackfaqs.com for a better snippet view)

See the available column at the end? That’s the stat you want to pay attention to.

On older OS\s, you’ll want to look at the free column but for the -/+ buffers/cache line. For example:

             total       used       free     shared    buffers     cached
Mem:          6082       2129       3953          0        145        760
-/+ buffers/cache:       1223       4858
Swap:         2047          0       2047

(code excerpts might look a little wonky via email. Check this post on hackfaqs.com for a better snippet view)

In this case, the system actually has 4858 MB of RAM available to use. Nifty, huh.