Changeset: e7949698e776 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e7949698e776 Modified Files: gdk/ChangeLog.Mar2011 gdk/gdk_utils.mx Branch: Mar2011 Log Message:
memory detection: fix for Darwin Use hw.memsize to obtain the physical memory installed in the system, instead of hw.usermem which is unreliable above 2G and doesn't exactly return what we do for other systems. At the same time, also use sysctl on Darwin to obtain the pagesize from the system (although the value happens to be the same as the fall-back default). diffs (48 lines): diff --git a/gdk/ChangeLog.Mar2011 b/gdk/ChangeLog.Mar2011 --- a/gdk/ChangeLog.Mar2011 +++ b/gdk/ChangeLog.Mar2011 @@ -1,3 +1,7 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Tue Mar 22 2011 Fabian Groffen <fab...@cwi.nl> +- Fixed memory detection on Darwin (Mac OS X) systems not to return + bogus values + diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx --- a/gdk/gdk_utils.mx +++ b/gdk/gdk_utils.mx @@ -466,6 +466,16 @@ #else # if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) _MT_pagesize = sysconf(_SC_PAGESIZE); +# else +# if defined(HAVE_SYS_SYSCTL_H) && defined(HW_PAGESIZE) + { + int size; + size_t len = sizeof(size); + + sysctlbyname("hw.pagesize", &size, &len, NULL, 0); + _MT_pagesize = size; + } +# endif # endif #endif if (_MT_pagesize <= 0) @@ -491,14 +501,12 @@ # if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) _MT_npages = sysconf(_SC_PHYS_PAGES); # else -# if defined(HAVE_SYS_SYSCTL_H) && defined(HW_USERMEM) +# if defined(HAVE_SYS_SYSCTL_H) && defined(HW_MEMSIZE) { uint64_t size; size_t len = sizeof(size); - /* This is the 'non-kernel memory', e.g. what's left to a user - * process to allocate. */ - sysctlbyname("hw.usermem", &size, &len, NULL, 0); + sysctlbyname("hw.memsize", &size, &len, NULL, 0); _MT_npages = size / _MT_pagesize; } # else _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list