Why dmesg | grep Memory gives two different physical memory amounts

dmesgmemory

I am monitoring physical memory in a server I administer, and my hardware provider told me they had increased physical memory size to 4Gb…

However, using several tools (free -m; top; dmesg | grep Memory; grep MemTotal /proc/meminfo I discovered that I actually have 3Gb, not 4…

But, my doubt comes from the fact that dmesg | grem Memory tells me I have
3103396k/4194304k available

The first number is effectively 3Gb, but the second one, is 4! so, why I am looking at this two different numbers? Am I missing something? or is it that my provider is telling me the truth but he hasn't configured things right?

I am not sure if this thread goes in here at this subforum, please correct and redirect me if so…

Thank you very much!

Best Answer

It's seems like you use a 32-bit system on the computer. The amount of the memory depends on the motherboard (chipset's properties), but it always will be less than 4 Gb. To avoid this, there is two solutions.

  • To use whole 4 Gb of RAM, the kernel should be compiled with:

    CONFIG_HIGHMEM4G=y

    or

    CONFIG_HIGHMEM64G=y

    options. Which will allow every program to address something about 4 Gb of the system memory. If you will have more memory in the future, none of the programs will be able to use more than one piece, as large as maximum of 4 Gb on the 32-bit operating system.

  • The another solution - you can use 64-bit operating system and use all the memory available. So if you will ever get 8, 16, 32 Gb of RAM, every program will be able to use the whole memory you have in that case.

You can look up here: http://www.codinghorror.com/blog/2007/03/dude-wheres-my-4-gigabytes-of-ram.html for some exciting facts about the problem of using 4 Gb of the memory in 32-bit systems.