Skip to content

Commit d962cf2

Browse files
committed
Use the page size that host_statistics() pages are measured in
1 parent a1701dc commit d962cf2

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

mem/mem_darwin_cgo.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ package mem
55

66
/*
77
#include <mach/mach_host.h>
8+
#include <mach/vm_page_size.h>
89
*/
910
import "C"
1011

1112
import (
1213
"context"
1314
"fmt"
1415
"unsafe"
15-
16-
"golang.org/x/sys/unix"
1716
)
1817

1918
// VirtualMemory returns VirtualmemoryStat.
@@ -34,7 +33,7 @@ func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {
3433
return nil, fmt.Errorf("host_statistics error=%d", status)
3534
}
3635

37-
pageSize := uint64(unix.Getpagesize())
36+
pageSize := uint64(C.vm_kernel_page_size)
3837
total, err := getHwMemsize()
3938
if err != nil {
4039
return nil, err

0 commit comments

Comments
 (0)