From a9b0a4f6d3e7fd4c34a239201aaa2bd47f6a8877 Mon Sep 17 00:00:00 2001 From: Matthieu Guegan Date: Sun, 22 Oct 2017 12:02:57 +0200 Subject: [PATCH] Fix a memory allocation error on FreeBSD 10.3R On some condition, it is possible to hit a memory allocation failure when retrieving the `buffer_bytes` via `sysctl()`. Adding the `dataType` seems to fix this issue. --- collector/meminfo_bsd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/meminfo_bsd.go b/collector/meminfo_bsd.go index 0c722c243f..d51d4c6855 100644 --- a/collector/meminfo_bsd.go +++ b/collector/meminfo_bsd.go @@ -39,7 +39,7 @@ func (c *meminfoCollector) getMemInfo() (map[string]float64, error) { {name: "inactive_bytes", mib: "vm.stats.vm.v_inactive_count", conversion: fromPage}, {name: "wired_bytes", mib: "vm.stats.vm.v_wire_count", conversion: fromPage}, {name: "cache_bytes", mib: "vm.stats.vm.v_cache_count", conversion: fromPage}, - {name: "buffer_bytes", mib: "vfs.bufspace"}, + {name: "buffer_bytes", mib: "vfs.bufspace", dataType: bsdSysctlTypeUint64}, {name: "free_bytes", mib: "vm.stats.vm.v_free_count", conversion: fromPage}, {name: "size_bytes", mib: "vm.stats.vm.v_page_count", conversion: fromPage}, {name: "swap_in_bytes_total", mib: "vm.stats.vm.v_swappgsin", conversion: fromPage},