Showing results for 
Search instead for 
Did you mean: 

RAM percentage utilised in Linux

Regular Advisor

RAM percentage utilised in Linux

We are planning to calculate the percentage of physical memory utilised as below:

top outout:
System Page Size: 4Kbytes
Memory: 5343128K (1562428K) real, 13632356K (3504760K) virtual, 66088K free Page# 1/604

Now the formula goes as below:

(free memory / actual active real memory) * 100
(66088/1562428) * 100 = 4.22 %

Please let us know if its the correct formula .

Mainly we are interested in RAM percentage utilised
Honored Contributor

Re: RAM percentage utilised in Linux

is this method helpful to find the % of mem usage

# free -mt
total used free shared buffers cached
Mem: 3768 3705 63 0 467 2912
-/+ buffers/cache: 324 3443
Swap: 2047 99 1947
Total: 5815 3804 2010
Steven E. Protter
Exalted Contributor

Re: RAM percentage utilised in Linux


Red Hat/Centos v 5 take spare ram and use it for a buffer cache.

100% memory allocation is pretty meaningless because allocation is almost always near 100%. The 2.6.x kernel permits rapid re-allocation of buffer to other purposes eliminating a performance penalty that you see on an OS like HP-UX

I'm not thrilled with your formula because it includes swap(virtual memory). If you start digging too deep into virtual memory, your system start paging processes from memory to disk and back again and slows down badly.

The formula is however essentially correct.

Steven E Protter
Owner of ISN Corporation
Stuart Browne
Honored Contributor

Re: RAM percentage utilised in Linux

Here, a quick example from the machine under my desk:

Mem: 3849216k total, 3648280k used, 200936k free, 210960k buffers
Swap: 4194296k total, 64k used, 4194232k free, 2986460k cached

If the value of 'Swap used' is up (i.e. hundreds of megabytes), then you've got an issue, but as you can see, it's only 64k here.

Your formula for how much memory is used is something along the lines of this:

(Used - (Buffers + Cached) / Total) * 100 = Used-by-programs%
(Free + Buffers + Cached / Total) * 100 = Free%

.. Roughly ..
One long-haired git at your service...
dirk dierickx
Honored Contributor

Re: RAM percentage utilised in Linux

if the system is using lots of swap, that is not by default a 'problem'. the problem is there when you constantly need to get stuff in and out of the swap space.
a filled up swap, with stuff that is rarely needed is not a problem in my book.