Documentation ¶
Overview ¶
Package memory provides a single method reporting total system memory accessible to the kernel.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FreeMemory ¶
func FreeMemory() uint64
FreeMemory returns the total free system memory in bytes.
The total free memory is installed physical memory size minus reserved areas for other applications running on the same system.
If free memory size could not be determined, then 0 is returned.
Example ¶
package main import ( "fmt" "github.com/pbnjay/memory" ) func main() { fmt.Printf("Free system memory: %d\n", memory.FreeMemory()) }
Output:
func TotalMemory ¶
func TotalMemory() uint64
TotalMemory returns the total accessible system memory in bytes.
The total accessible memory is installed physical memory size minus reserved areas for the kernel and hardware, if such reservations are reported by the operating system.
If accessible memory size could not be determined, then 0 is returned.
Example ¶
package main import ( "fmt" "github.com/pbnjay/memory" ) func main() { fmt.Printf("Total system memory: %d\n", memory.TotalMemory()) }
Output:
Types ¶
This section is empty.