Index: /trunk/src/VBox/Main/src-server/darwin/PerformanceDarwin.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/darwin/PerformanceDarwin.cpp	(revision 43554)
+++ /trunk/src/VBox/Main/src-server/darwin/PerformanceDarwin.cpp	(revision 43555)
@@ -26,4 +26,5 @@
 #include <iprt/log.h>
 #include <iprt/param.h>
+#include <iprt/system.h>
 #include "Performance.h"
 
@@ -74,17 +75,10 @@
 CollectorDarwin::CollectorDarwin()
 {
-    uint64_t hostMemory;
-    int mib[2];
-    size_t size;
-
-    mib[0] = CTL_HW;
-    mib[1] = HW_MEMSIZE;
-
-    size = sizeof(hostMemory);
-    if (sysctl(mib, 2, &hostMemory, &size, NULL, 0) == -1) {
-        Log(("sysctl() -> %s", strerror(errno)));
-        hostMemory = 0;
-    }
-    totalRAM = (ULONG)(hostMemory / 1024);
+    uint64_t cb;
+    int rc = RTSystemQueryTotalRam(&cb);
+    if (RT_FAILED(rc))
+        totalRAM = 0;
+    else
+        totalRAM = (ULONG)(cb / 1024);
 }
 
@@ -113,21 +107,13 @@
 int CollectorDarwin::getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available)
 {
-    kern_return_t krc;
-    mach_msg_type_number_t count;
-    vm_statistics_data_t info;
-
-    count = HOST_VM_INFO_COUNT;
-
-    krc = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&info, &count);
-    if (krc != KERN_SUCCESS)
+    uint64_t cb;
+    int rc = RTSystemQueryAvailableRam(&cb);
+    if (RT_SUCCESS(rc))
     {
-        Log(("host_statistics() -> %s", mach_error_string(krc)));
-        return RTErrConvertFromDarwinKern(krc);
+        *total = totalRAM;
+        *available = cb / 1024;
+        *used = *total - *available;
     }
-
-    *total = totalRAM;
-    *available = info.free_count * (PAGE_SIZE / 1024);
-    *used = *total - *available;
-    return VINF_SUCCESS;
+    return rc;
 }
 
