1

I have a static memory splitting (configured in config file and confirmed by vcgencmd) of

arm=496M
gpu=16M

But when I run free -h I get

             total       used       free     shared    buffers     cached
Mem:          485M       184M       300M         0B        17M       128M
-/+ buffers/cache:        38M       446M
Swap:           0B         0B         0B

So, a total of 485 MB instead of 496 MB. Where did the 11 MB go? Also, the sum of columns used + free is 484 MB instead of 485 MB. How does the memory calculation work? free agrees with cat /proc/meminfo, as a side note.

Why are these numbers not matching?

  • 2
    496*1000/1024=484. Different definitions of what is kilo is (1000 or 1024). – Gerben May 26 '14 at 11:42
1

on my system:

$ free
             total       used       free     shared    buffers     cached
Mem:        496948     260252     236696          0       6560     210968
-/+ buffers/cache:      42724     454224
Swap:       102396      21940      80456
$

260252 + 236696 = 496948, and you should drop -h switch to avoid rounding errors.

  • This does it also show for me. 496948 / 1024 = 485MB. So, free -h calculates correctly. 496 MB * 1024 should be 507904 kB, however. So, there are still some MB missing. – Foo Bar May 26 '14 at 7:06
  • there are megabytes of 1024kb size and there are megabytes of 1000kb size, you should not worry this much about it. – lenik May 26 '14 at 7:18
  • I know about 2-based and 10-based prefixes, but some tools on the Raspberry Pi seem to use/name it not consistently, and now I'd like to know where the "bug" sits and which numbers to trust. – Foo Bar May 26 '14 at 7:23

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.