Skip to content

Commit

Permalink
Use the page size that host_statistics() pages are measured in
Browse files Browse the repository at this point in the history
  • Loading branch information
kyz committed Jul 25, 2022
1 parent a1701dc commit d962cf2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mem/mem_darwin_cgo.go
Expand Up @@ -5,15 +5,14 @@ package mem

/*
#include <mach/mach_host.h>
#include <mach/vm_page_size.h>
*/
import "C"

import (
"context"
"fmt"
"unsafe"

"golang.org/x/sys/unix"
)

// VirtualMemory returns VirtualmemoryStat.
Expand All @@ -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
Expand Down

0 comments on commit d962cf2

Please sign in to comment.