Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Last active November 8, 2022 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/e5a69b68775f8840ca2c49b7fd7ec5c5 to your computer and use it in GitHub Desktop.
Save BetterProgramming/e5a69b68775f8840ca2c49b7fd7ec5c5 to your computer and use it in GitHub Desktop.
func TestMemStats(t *testing.T) {
var m runtime.MemStats
runtime.ReadMemStats(&m)
v := reflect.ValueOf(&m).Elem()
for i := 0; i < v.NumField(); i++ {
t.Logf("%s %s %v \n",
v.Field(i).Type(),
v.Type().Field(i).Name,
v.Field(i).Interface())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment