Skip to content

Instantly share code, notes, and snippets.

@j16r
Created November 9, 2015 15:32
Show Gist options
  • Save j16r/52060542b1a97bdb2dda to your computer and use it in GitHub Desktop.
Save j16r/52060542b1a97bdb2dda to your computer and use it in GitHub Desktop.
Go allows for reading the VM's memory statistics, neat!
package main
import (
"fmt"
"runtime"
)
func main() {
s := new(runtime.MemStats)
runtime.ReadMemStats(s)
fmt.Println("Alloc : ", s.Alloc)
fmt.Println("Total Alloc : ", s.TotalAlloc)
fmt.Println("Sys : ", s.Sys)
fmt.Println("Lookups : ", s.Lookups)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment