+#if defined(HOST_VM_INFO)
+ kern_return_t status;
+ vm_statistics_data_t vm_data;
+ mach_msg_type_number_t vm_data_len;
+
+ long long wired;
+ long long active;
+ long long inactive;
+ long long free;
+
+ if (!port_host || !pagesize)
+ return;
+
+ vm_data_len = sizeof (vm_data) / sizeof (natural_t);
+ if ((status = host_statistics (port_host, HOST_VM_INFO,
+ (host_info_t) &vm_data,
+ &vm_data_len)) != KERN_SUCCESS)
+ {
+ syslog (LOG_ERR, "memory-plugin: host_statistics failed and returned the value %i", (int) status);
+ return;
+ }
+
+ /*
+ * From <http://docs.info.apple.com/article.html?artnum=107918>:
+ *
+ * Wired memory
+ * This information can't be cached to disk, so it must stay in RAM.
+ * The amount depends on what applications you are using.
+ *
+ * Active memory
+ * This information is currently in RAM and actively being used.
+ *
+ * Inactive memory
+ * This information is no longer being used and has been cached to
+ * disk, but it will remain in RAM until another application needs
+ * the space. Leaving this information in RAM is to your advantage if
+ * you (or a client of your computer) come back to it later.
+ *
+ * Free memory
+ * This memory is not being used.
+ */
+
+ wired = vm_data.wire_count * pagesize;
+ active = vm_data.active_count * pagesize;
+ inactive = vm_data.inactive_count * pagesize;
+ free = vm_stat.free_count * pagesize;
+
+ memory_submit (wired + active, -1, inactive, free);
+/* #endif HOST_VM_INFO */
+
+#elif defined(KERNEL_LINUX)