memory question

Hi all,

I'm a little confused - I have a Linode 512 and running free -m shows I've only got 498MB:

[root@li190-223 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:           498         40        458          0          1         22
-/+ buffers/cache:         17        481
Swap:          255          0        255
[root@li190-223 ~]#

However I also have a 512 Burstnet VPS and running the same command gives 512MB:

linvak:~# free -m
             total       used       free     shared    buffers     cached
Mem:           512         23        489          0          0          0
-/+ buffers/cache:         23        489
Swap:            0          0          0
linvak:~#

Any ideas please?

7 Replies

Shrug. The kernel reserves some memory for itself. Depending on your kernel, it may or may not be subtracted from the total "free -m" lists. Don't worry about it, unless it's like 200 MB or something. :P

Okies thanks for the help.

I thought that the first field in free should display the total physical memory in the machine irrespective of kernel usage.

Guess I'm wrong :wink:

It depends on the kernel. Kernels marked as "Stable" show the full 512MB. Kernels marked as "Paravirt" (which is required for newer distributions such as Ubuntu 10.04) tend to show a little less.

And distribution kernels show more!

total used free shared buffers cached

Mem: 527 511 16 0 8 299

-/+ buffers/cache: 203 323

Swap: 255 81 174

@Mr Nod:

I thought that the first field in free should display the total physical memory in the machine irrespective of kernel usage.

Guess I'm wrong :wink:
Well it probably should, but that doesn't mean it does, and it's not a serious issue.

@obs:

And distribution kernels show more!
I bet it's erroneously adding the freed initrd memory to the total.

The kernel will show its math during boot:

$ ssh framboise dmesg | grep ^Memory:
Memory: 509956k/524288k available (5104k kernel code, 13672k reserved, 1584k data, 396k init, 0k highmem)

Those numbers don't exactly add up, but 509956 kB + 13672 kB comes up 660 kB short, and…. well, that's close enough to 640 kB that it ought to be close enough for anybody. Other messages spat by the kernel will provide a more detailed, and significantly more confusing, accounting.

Why the difference? Sometime between 2.6.18 ("Latest 2.6 Stable") and a few years back, the formula changed. Dunno where, who, or why, but it's probably more accurate now.

Heh what confusion :D

Think it'll be more accurate for me to parse dmesg then instead!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct