Salome HOME
Patch for MacOS (from SALOME forum)
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis.cxx
index 2f2650e39fde8590511bf85315a77df043713a5c..e5f3c4d1e054ef5f7285ae080bb1d73791699f43 100644 (file)
@@ -851,22 +851,15 @@ bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
 //function : DefaultMaximumMemory
 //=======================================================================
 
-#ifndef WIN32
-#include <sys/sysinfo.h>
-#else
+#if defined(WIN32)
 #include <windows.h>
+#elif !defined(__APPLE__)
+#include <sys/sysinfo.h>
 #endif
 
-long  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
+long GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
 {
-#ifndef WIN32
-  struct sysinfo si;
-  long err = sysinfo( &si );
-  if ( err == 0 ) {
-    long ramMB = si.totalram * si.mem_unit / 1024 / 1024;
-    return ( 0.7 * ramMB );
-  }
-#else
+#if defined(WIN32)
   // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
   MEMORYSTATUSEX statex;
   statex.dwLength = sizeof (statex);
@@ -875,6 +868,13 @@ long  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
     double totMB = (double)statex.ullAvailPhys / 1024. / 1024.;
     return (long)( 0.7 * totMB );
   }
+#elif !defined(__APPLE__)
+  struct sysinfo si;
+  long err = sysinfo( &si );
+  if ( err == 0 ) {
+    long ramMB = si.totalram * si.mem_unit / 1024 / 1024;
+    return ( 0.7 * ramMB );
+  }
 #endif
   return 1024;
 }