diff --git a/cpu/cpu_darwin_cgo.go b/cpu/cpu_darwin_cgo.go index 6b813d78..180e0afa 100644 --- a/cpu/cpu_darwin_cgo.go +++ b/cpu/cpu_darwin_cgo.go @@ -57,7 +57,7 @@ func perCPUTimes() ([]TimesStat, error) { // copy the cpuload array to a []byte buffer // where we can binary.Read the data size := int(ncpu) * binary.Size(cpu_ticks) - buf := C.GoBytes(unsafe.Pointer(cpuload), C.int(size)) + buf := (*[1 << 30]byte)(unsafe.Pointer(cpuload))[:size:size] bbuf := bytes.NewBuffer(buf)