cpu[darwin]: fix Go arrays panic in cgo #279

pull/280/head
Shirou WAKAYAMA 8 years ago
parent a63900a44b
commit ae251eb6a2

@ -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)

Loading…
Cancel
Save