A thousand pardons for the duplicate post - forgot the subject on the original!!
--- All, I have a need to be able to determine the amount of physical memory in a machine. Looking at the man page for sysctl(), that seems to be the answer, but it behaves a oddly in that it doesn't return what I feel is the actual amount of RAM in the machine. It appears to be taking some memory off the top (for kernel structures?), and not actually reporting the physical memory. Here's my example: ---- #include <stdio.h> #include <sys/types.h> #include <sys/sysctl.h> int main () { int mib[2], realmem; size_t len; mib[0] = CTL_HW; mib[1] = HW_PHYSMEM; len = sizeof(realmem); sysctl(mib,2,(void *) &realmem, (void *) &len,NULL,0); printf ("%d bytes\n\n", realmem); } ---- On the machine that I'm using, this is returning 534564864, which, when divided by (1024 * 1024), returns 509. The machine has 512MB in it, so it's losing 3MB somewhere. It's more of an annoyance than anything, but I need to be able to report this number accurately regardless of the machine it's on. Losing memory to kernel or what have you is not consistent with this reporting physical memory. The machine I'm running is running 4.4-RELEASE, with 512MB RAM. Can anyone point me in the direction of where I may be going wrong? Many thanks, Rich -- Rich Haney Senior Operations Tools Developer NTT/VERIO 561-999-8339 Lubarsky's Law of Cybernetic Entomology: There's always one more bug. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message