Standard library / os

os.Getpagesize()

Reports the underlying system memory page size in bytes; do not assume 4096 on every architecture. Example intended for Linux/AMD64 with Go 1.23.2 in a disposable working directory; other platforms may differ. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func Getpagesize() int

Return Value

int

Reports the underlying system memory page size in bytes; do not assume 4096 on every architecture.

Working Example

Example Snippetgo
package main
import (  "fmt"  "os")
func must(e error) {  if e != nil {    panic(e)  }}func main() { fmt.Println(os.Getpagesize() > 0) }
Go Reference