Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mem.VirtualMemory(): wrong page size on darwin arm64 #1334

Merged
merged 1 commit into from Jul 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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