To see what users are sucking RAM:
smem -u and smem -u -p tell you exactly which user is using RAM.
Get smem here: https://www.selenic.com/smem/
—
To see available cached RAM:
If all your memory is getting used, take a closer look to see which memory is being sucked up by disk cache and is actually available instantly to any app that needs it:
free -m or watch free -m to constantly monitor your RAM usage.
Example:
root@niagra [~]# free -m
total used free shared buffers cached
Mem: 32101 30831 1270 0 640 27716
-/+ buffers/cache: 2473 29627
Swap: 8191 0 8191
That bolded number is actually what’s available at any time instantaneously.
It’s in the row “+/- buffers/cache” under the column “free”
Memory that is | You’d call it | Linux calls it |
---|---|---|
taken by applications | Used | Used |
available for applications, and used for something | Free | Used |
not used for anything | Free | Free |
—
To release cached memory and get your RAM back:
echo 3 | sudo tee /proc/sys/vm/drop_caches
Then wait 3 seconds and run free -m again, you’ll see the memory was released from cache but this should not be necessary since the column “free” showing on “+/- buffers/cache” didn’t change much.
—
I also use a variation of “top” called “mem”, it’s an RPM that must be installed.
—
To turn swap on or off: sudo swapoff -a and sudo swapon -a
To see everything about your RAM: sudo dmidecode -t 17