From: Florian Forster Date: Mon, 14 Dec 2009 16:58:55 +0000 (+0100) Subject: memory plugin: Fixed handling of >4G of memory on Mac OS X. X-Git-Tag: collectd-4.7.5~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1b0247c6e1c5b3a73bfd389bfadd3c2a5abed8ca;p=collectd.git memory plugin: Fixed handling of >4G of memory on Mac OS X. --- diff --git a/src/memory.c b/src/memory.c index 799a80c3..b2da5efa 100644 --- a/src/memory.c +++ b/src/memory.c @@ -145,10 +145,10 @@ static int memory_read (void) 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; + gauge_t wired; + gauge_t active; + gauge_t inactive; + gauge_t free; if (!port_host || !pagesize) return (-1); @@ -182,10 +182,10 @@ static int memory_read (void) * 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_data.free_count * pagesize; + wired = (gauge_t) (((uint64_t) vm_data.wire_count) * ((uint64_t) pagesize)); + active = (gauge_t) (((uint64_t) vm_data.active_count) * ((uint64_t) pagesize)); + inactive = (gauge_t) (((uint64_t) vm_data.inactive_count) * ((uint64_t) pagesize)); + free = (gauge_t) (((uint64_t) vm_data.free_count) * ((uint64_t) pagesize)); memory_submit ("wired", wired); memory_submit ("active", active);