[fpc-devel] Linux.SysInfo Problem
Marco van de Voort
marcov at stack.nl
Fri Mar 19 10:30:15 CET 2010
In our previous episode, Andrew Brunner said:
> This was tested on Ubuntu x64 10.04
> 64bit AMD with 3Gigs of RAM
> Load_Ram:=(100-Trunc(100 * SI.freeram / SI.totalram));
> Si.totalram checks out ok. SI.freeram never seems to be accurate.
> The numbers returned here do not correspond to that of System Monitor
> for the same user.
> When using sudo ./startlazarus and debugging process (I'm debugging
> project that requires low port numbers) the numbers are even more off.
> What is the problem with Linux? Windows GlobalMemoryStatus works just fine.
Windows api doesn't fluctuate so much with time.
> This function is essential for server management and trouble shooting.
Maybe they changed the record. I'm not sure it even was validated for 64-bit
The simplest way to debug this is to make a minimal C program using the
function, and then check the size of the record. If that is ok, check if the
libc function does more than just passing all params on to the call.
I got indications that something changed on Debian (also on 32-bit), but
wasn't able to reproduce it
the reporters there seem to indicate that it goes wrong with 2GB+ ram.
More information about the fpc-devel