I want to know to how to calculate total RAM, how we can reach at RAM size by summing up the output of "cat proc/meminfo" command
Memtotal = MemFree+?...........
any one can help
I want to know to how to calculate total RAM, how we can reach at RAM size by summing up the output of "cat proc/meminfo" command
Memtotal = MemFree+?...........
any one can help
You need a tool that takes shared memory into account to do this.
For example, smem:
# smem -t
PID User Command Swap USS PSS RSS
...
10593 root /usr/lib/chromium-browser/c 0 22868 26439 49364
11500 root /usr/lib/chromium-browser/c 0 22612 26486 49732
10474 browser /usr/lib/chromium-browser/c 0 39232 43806 61560
7777 user /usr/lib/thunderbird/thunde 0 89652 91118 102756
-------------------------------------------------------------------------------
118 4 40364 594228 653873 1153092
PSS
is the interesting column here because it takes shared memory into account (adding RSS
together will result in shared mem segments being counted multiple times so numbers won't add up).
So userland processes take up 654Mb total here.
# smem -tw
Area Used Cache Noncache
firmware/hardware 0 0 0
kernel image 0 0 0
kernel dynamic memory 345784 297092 48692
userspace memory 654056 181076 472980
free memory 15828 15828 0
----------------------------------------------------------
1015668 493996 521672
346Mb is used by the kernel and there's 16Mb free.
Overall about half of memory is used for cache (494Mb).
So 1Gb RAM total = 654Mb userland processes, broken up as above + 346Mb kernel mem + 16Mb free
(give or take a few Mb)