Exact RAM size.

David Tonhofer redhatter at m-plify.net
Fri Nov 14 10:40:16 UTC 2008


Rohit khaladkar wrote:
> Hi!I have Red Hat linux 4.5 and 5.2 installed on my systems. There is a
> application which tells me, how much exact RAM size is required to load
> another application.For eg : it would be 20 GB or 2 GB.
> Now when I run my script I need to find out the RAM size.But if the server
> ordered is of 2GB RAM size , exactly 2GB is never shown by the system. It is
> a little less than 2GB.Is there any way I can have a criteria
> to tell how much is the exact RAM size.
>
> Thanks!
> Rohit Khaladkar
>   
Well, what the operating system tells you counts.

For example, if you have 4 GiB installed (as given by the DIMM sizes), 
then the OS
will announce less:

-- because the hardware will not see part of the RAM as it will be 
hidden by memory-mapped devices
-- because the kernel reserves a part for the crash handler
-- because of the kernel image

So you just do "cat /proc/meminfo" (or alternatively 'free', which reads 
/proc/meminfo) and read off "MemTotal".
This is all the free memory you get.

Kernel data structures, I/O caches and the User processes will all have 
to go in there.













More information about the redhat-list mailing list