Home »
Golang »
Golang Reference
Golang os.Getpagesize() Function with Examples
Golang | os.Getpagesize() Function: Here, we are going to learn about the Getpagesize() function of the os package with its usages, syntax, and examples.
Submitted by IncludeHelp, on November 19, 2021
os.Getpagesize()
In the Go language, the os package provides a platform-independent interface to operating system (Unix-like) functionality. The Getpagesize() function is an inbuilt function of the os package, it is used to get the underlying system's memory page size.
It accepts nothing and returns an integer that is the system's memory page size.
Syntax
func Getpagesize() int
Parameters
Return Value
The return type of the os.Getpagesize() function is an int, it returns the underlying system's memory page size.
Example
// Golang program to demonstrate the
// example of Getpagesize() function
package main
import (
"fmt"
"os"
)
func main() {
pagesize := os.Getpagesize()
fmt.Printf("pagesize: %T, %v\n",
pagesize, pagesize)
}
Output:
pagesize: int, 4096
Golang os Package »