Skip to content

Commit

Permalink
Merge pull request #1334 from kyz/fix-darwin-pagesize
Browse files Browse the repository at this point in the history
mem.VirtualMemory(): wrong page size on darwin arm64
  • Loading branch information
shirou committed Jul 29, 2022
2 parents a1701dc + d962cf2 commit 190dfee
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 190dfee

Please sign in to comment.