uses to determine the placement of values that are created by your program Stack allocation is cheap and heap allocation is expensive (!!!) Stack allocation requires that the lifetime and memory footprint of a variable can be determined at compile time (!!!)
decisions -m can be speci ed multiple times go (build|test) -gcflags "-m -m" ... out: ./prelude_test.go:25:31: leaking param: c ./prelude_test.go:25:31: from c.description() (receiver in indirect call) at ./prelude_test.go:26 ./prelude_test.go:34:25: c escapes to heap ./prelude_test.go:34:25: from c (passed to call[argument escapes]) at ./prelude_test.go:34:25 ./prelude_test.go:33:19: &click literal escapes to heap ./prelude_test.go:33:19: from c (assigned) at ./prelude_test.go:33:5 ./prelude_test.go:33:19: from c (interface-converted) at ./prelude_test.go:34:25 ./prelude_test.go:33:19: from c (passed to call[argument escapes]) at ./prelude_test.go:34:25
"-m -m" shows as: _*value of map put*_ func BenchmarkMap(b *testing.B) { for i := 0; i < b.N; i++ { c := new(click) m := make(map[string]*click, 0) m["foo"] = c } } slice In the out of -gc ags "-m -m" shows as: *slice-element-equals* func BenchmarkSlice(b *testing.B) { for i := 0; i < b.N; i++ { c := new(click) s := make([]*click, 1) s[0] = c } }