Standard library / runtime

runtime.ReadMemStats()

Fills a snapshot of allocator statistics. Interpret fields according to their units and scope; process RSS is a different measurement. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func ReadMemStats(m *MemStats)

Parameters & Attributes

NameTypeDescription
m*MemStatsNon-nil destination for the allocator snapshot.

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime")
func main() {  var m runtime.MemStats  runtime.ReadMemStats(&m)  fmt.Println(m.TotalAlloc >= m.HeapAlloc)}
Go Reference