LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   free -m command displays less RAM size (https://www.linuxquestions.org/questions/linux-newbie-8/free-m-command-displays-less-ram-size-640244/)

babu198649 05-06-2008 05:44 AM

free -m command displays less RAM size
 
hi
my RAM size is 512MB but the command free -m shows 494

Code:

[babu@localhost ~]$ free -m
            total      used      free    shared    buffers    cached
Mem:          494        382        112          0          9        104
-/+ buffers/cache:        267        226
Swap:          991          1        990

Is it the right command.

H_TeXMeX_H 05-06-2008 01:23 PM

Well, AFAIK, some of the RAM is reserved by BIOS and other things, and cannot be used by the OS. That could explain it. And on many laptops the memory is shared with graphics card, for example here on my laptop with 1 GB RAM I get:

Code:

            total      used      free    shared    buffers    cached
Mem:          1009        517        492          0          0        276
-/+ buffers/cache:        240        768
Swap:        1921          0      1921


viron 05-06-2008 03:15 PM

Quote:

Originally Posted by babu198649 (Post 3144354)
hi
my RAM size is 512MB but the command free -m shows 494

Code:

[babu@localhost ~]$ free -m
            total      used      free    shared    buffers    cached
Mem:          494        382        112          0          9        104
-/+ buffers/cache:        267        226
Swap:          991          1        990

Is it the right command.



It all has to do with how one defines a kilo...1000 or 1024 (1024 is the correct binary measurement). If you take the total mem from the free command (no -m switch) and divide that by 1024, you'll come up with 494. However...if you take that same total and divide it by 1000 (metric), you'll come up with the amount you're looking for. =)

H_TeXMeX_H 05-07-2008 01:11 PM

Quote:

Originally Posted by viron (Post 3144884)
It all has to do with how one defines a kilo...1000 or 1024 (1024 is the correct binary measurement). If you take the total mem from the free command (no -m switch) and divide that by 1024, you'll come up with 494. However...if you take that same total and divide it by 1000 (metric), you'll come up with the amount you're looking for. =)

Are you sure ? Thought that was only true for HDDs. For example take my case:

1058439168 bytes reported by 'free -b', divide that by 1000000 and you get 1058, which is too much. When I run just 'free' I get 1033632 ko, divide that by 1000 and you get 1033, still too much.

babu198649 05-08-2008 03:45 AM

Thanks for replys

Quote:

It all has to do with how one defines a kilo...1000 or 1024 (1024 is the correct binary measurement). If you take the total mem from the free command (no -m switch) and divide that by 1024, you'll come up with 494. However...if you take that same total and divide it by 1000 (metric), you'll come up with the amount you're looking for. =)

[bala@localhost ~]$ free
total used free shared buffers cached
Mem: 506436 492432 14004 0 16048 222372
-/+ buffers/cache: 254012 252424
Swap: 1015800 0 1015800


506436/1000 = 506.436 which is != 512 as expected.



Quote:

Well, AFAIK, some of the RAM is reserved by BIOS and other things, and cannot be used by the OS.
how to find how much memory has been used by BIOS.

premnarayan 05-08-2008 07:13 AM

Your RAM has 506436 kB = 506436/1024 MB = 494.5 MB. That's what free -m says.

H_TeXMeX_H 05-08-2008 12:51 PM

Quote:

Originally Posted by babu198649 (Post 3146611)
how to find how much memory has been used by BIOS.

run:

Code:

cat /proc/iomem


All times are GMT -5. The time now is 12:47 AM.