Use the page size that host_statistics() pages are measured in

pull/1334/head
Stuart Caie 3 years ago
parent a1701dcb73
commit d962cf2d68

@ -5,6 +5,7 @@ package mem
/*
#include <mach/mach_host.h>
#include <mach/vm_page_size.h>
*/
import "C"
@ -12,8 +13,6 @@ import (
"context"
"fmt"
"unsafe"
"golang.org/x/sys/unix"
)
// VirtualMemory returns VirtualmemoryStat.
@ -34,7 +33,7 @@ func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {
return nil, fmt.Errorf("host_statistics error=%d", status)
}
pageSize := uint64(unix.Getpagesize())
pageSize := uint64(C.vm_kernel_page_size)
total, err := getHwMemsize()
if err != nil {
return nil, err

Loading…
Cancel
Save