[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Incorrect reporting of memory installed on system by "free"?




> -----Original Message-----
> From: Tech Geek [mailto:techgeek12345@gmail.com] 
> Sent: Tuesday, 02 February, 2010 09:18
> To: debian-user@lists.debian.org
> Subject: Incorrect reporting of memory installed on system by "free"?
> 
> So I know my system has 2 GB Memory.
>  
( snip )

> debian:~# free -k
>              total       used       free     shared    
> buffers     cached
> Mem:       2063496    2033428      30068          0     
> 396828     744344
> -/+ buffers/cache:     892256    1171240
> Swap:      3903752      58444    3845308
> 
> debian:~# free -m
>              total       used       free     shared    
> buffers     cached
> Mem:          2015       1985         29          0        
> 387        726
> -/+ buffers/cache:        871       1143
> Swap:         3812         57       3755
> 
> So far everything looks good. However when I try to report 
> the memory in GBs, I get:
>  
> debian:~# free -g
>              total       used       free     shared    
> buffers     cached
> Mem:             1          1          0          0          
> 0          0
> -/+ buffers/cache:          0          1
> Swap:            3          0          3
> 
> It just shows that there is just 1 GB of memory installed in 
> total. Am I missing something? Should I file a bug report?
>  
> Thanks
>  
Don't file a bug, it is expected behavior.  It is using integers.

Some of your physical RAM is being used for video, the kernel, whatever.  So it is not available to your system.  That's why it is reporting 2015MB instead of the expected 2048MB for 2GB.

( 2015 / 1024 ) = 1.96GB, which is what you are expecting.

But Int( 2015 / 1024 ) = 1, which is what you are seeing.

You can see this in a bash shell:

$ let x="(( 2015 / 1024 ))"
$ echo $x
$ 1

James Zuelow
Network Specialist
City and Borough of Juneau MIS (907)586-0236 

Reply to: