changeset 805:d9b944d764ab

- Uniformly calculate MB_OF_MEMORY for BSD using sysctl -n and awk. - Make an exception for the maximum amount of memory the build will use for OpenBSD (due to mmap based malloc and W^X, only 1 gig of VM is available for malloc + anon private mmap).
author kurt
date Tue, 20 Jan 2009 19:19:27 -0500
parents fc30e7f4b9b3
children e2f22afd9638
files make/common/shared/Platform.gmk
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/shared/Platform.gmk	Fri Jan 16 11:24:18 2009 -0500
+++ b/make/common/shared/Platform.gmk	Tue Jan 20 19:19:27 2009 -0500
@@ -339,11 +339,7 @@
   #    a fully built workspace.
   REQUIRED_FREE_SPACE=1500000
   # How much RAM does this machine have:
-  ifeq ($(OS_VENDOR), OpenBSD)
-    MB_OF_MEMORY=$(shell perl -e 'printf "%d", `sysctl hw.physmem | cut -d'=' -f2` / 1048576' )
-  else
-    MB_OF_MEMORY=$(shell expr `sysctl hw.physmem | cut -d' ' -f2` / 1048576 )
-  endif
+  MB_OF_MEMORY=$(shell sysctl -n hw.physmem | awk '{print int($$NF / 1048576); }' )
 endif
 
 # Windows with and without CYGWIN will be slightly different
@@ -534,6 +530,13 @@
 #    system swapping during the build.
 #    If we don't know, assume 512. Subtract 128 from MB for VM MAX.
 #    Don't set VM max over 1024-128=896.
+#    736 is the max.
+ifeq ($(OS_VENDOR), OpenBSD)
+  ABS_MAX_MEMORY := "736"
+else
+  ABS_MAX_MEMORY := "896"
+endif
+
 ifeq ($(JDK_HAS_MEM_INFO),)
   JDK_HAS_MEM_INFO=true
   export JDK_HAS_MEM_INFO
@@ -548,7 +551,7 @@
       if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
         expr $(MB_OF_MEMORY) '-' 128 2> $(DEV_NULL) ; \
       else \
-        echo "896"; \
+        echo $(ABS_MAX_MEMORY); \
       fi)
     MIN_VM_MEMORY := $(shell \
       if [ $(MAX_VM_MEMORY) -le 128 ] ; then \