Detect memory for heap sizing on OSX.

Patch by Cathy Daw, reviewed by brandonwilliams for CASSANDRA-5157
This commit is contained in:
Brandon Williams 2013-01-15 06:32:08 -06:00
parent 7eb47c50c3
commit 4faed779d1
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,11 @@ calculate_heap_sizes()
system_memory_in_mb=`prtconf | awk '/Memory size:/ {print $3}'`
system_cpu_cores=`psrinfo | wc -l`
;;
Darwin)
system_memory_in_bytes=`sysctl hw.memsize | awk '{print $2}'`
system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
;;
*)
# assume reasonable defaults for e.g. a modern desktop or
# cheap server