How do you determine the amount of system memory?

Jarod Wilson jarod at wilsonet.com
Wed Jul 16 16:17:34 EDT 2008


On Wed, 2008-07-16 at 15:57 -0400, Ben Scott wrote:
> On Wed, Jul 16, 2008 at 3:20 PM, Paul Lussier <p.lussier at comcast.net> wrote:
> > Recent Linux kernels have had a minor bug in that the amount of memory
> > reported in /proc/meminfo is incorrect.
> 
>   Got details?

/me curious too

>   Depending on how the bug manifests, it might be enough to compare
> with the output of free(1).  If they disagree significantly, bug
> exists.  If the bug effects more than /proc/meminfo, that won't work,
> of course.

Erhm, try strace'ing free... :)

...
open("/proc/meminfo", O_RDONLY)         = 3
lseek(3, 0, SEEK_SET)                   = 0
read(3, "MemTotal:      3989940 kB\nMemFre"..., 1023) = 748
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 9), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x7f973f11b000
write(1, "             total       used   "..., 74) = 74
write(1, "Mem:       3989940    3925812   "..., 74) = 74
write(1, "-/+ buffers/cache:    1862852   "..., 41) = 41
write(1, "Swap:      2008084        128   "..., 41) = 41
exit_group(0)                           = ?




-- 
Jarod Wilson
jarod at wilsonet.com



More information about the gnhlug-discuss mailing list