I have a 64bit desktop, running 32bit Debian - with 2G memory.

user@box:~/$ head -n 1 /proc/meminfo MemTotal: 2030324 kB

But when I ask free to report on memory I see:

user@box:~$ free -g
             total       used       free     shared    buffers     cached
Mem:             1          1          0          0          0          1
-/+ buffers/cache:          0          1
Swap:            2          0          2

I am confused as to why free reports only 1G total memory when actually physical memory is 2G. Could someone explain how to correctly reconcile the output of free against my machine spec?


This is a rounding issue. For example on one of my machines:

devtest:~# free -m
             total       used       free     shared    buffers     cached
Mem:          7881       2780       5100          0         26       2417
-/+ buffers/cache:        336       7545
Swap:         7632          0       7632
devtest:~# free -g
             total       used       free     shared    buffers     cached
Mem:             7          2          4          0          0          2
-/+ buffers/cache:          0          7
Swap:            7          0          7

7,881 MiB is actually ~7.70 GiB but free -g is rounding down to 7 rather than up to 8. Likewise there is ~4.98 GiB free memory but free -g is rounding this down to 4 not up to 5.

Total memory reported by free does not include memory the kernel can not access (in the case of the server above due to chipset limitations not letting the last chunk of the 8Gb is has be used, in some cases a machine's video card may claim some RAM if it doesn't have its own) nor does it report the small chunk of RAM the kernel is unpacked into at boot (so on one of the smaller VMs on the host above which has 128M allocated, free only reports 126,616 K, 123 M (where it is actually more like 123.6 M) or 0 G) - so you will never see the same value as your physical total RAM in free -g.

In your case free is seeing 1,982.7 M or 1.94 G which it is rounding down to 1.

  • yes, reporting in mb or kb gives the expected answer.
    – Joel
    Feb 8 '10 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.