On 2013-Mar-29 20:27:27 -0400, Rod Person <rodper...@rodperson.com> wrote: >Everything is going we except that the program gives warnings that there >isn't enough free memory on the system to perform certain actions.
That premise sounds suspiciously like the upstream author doesn't understand how Unix VM works. >int getSysCtl(int top_level, int next_level){ > int mib[2], ctlvalue; > size_t len; > > mib[0] = top_level; > mib[1] = next_level; > len = sizeof(ctlvalue); > > sysctl(mib, 2, &ctlvalue, &len, NULL, 0); > > return ctlvalue; >} > > >int main(void){ > int realmem = getSysCtl(CTL_HW, HW_REALMEM); > int usermem = getSysCtl(CTL_HW, HW_USERMEM); HW_REALMEM and HW_USERMEM return an unsigned long, not an int. That probably explains the nonsense value you are seeing in 'User Memory'. > printf("Total VM Memory: %i\n",vmsize.t_vm); > printf("Total Real Memory: %i\n",vmsize.t_rm); > printf("shared real memory: %i\n",vmsize.t_rmshr); > printf("active shared real memory: %i\n",vmsize.t_armshr); > printf("Total Free Memory pages: %i\n",vmsize.t_free); And these numbers are all in pages as you surmise. -- Peter Jeremy
pgpcVmlAkNW_M.pgp
Description: PGP signature