➜ p8 go run -gcflags '-m -m -l' main.go
# command-line-arguments# ..../main.go:17:16: y escapes to heap:
./main.go:17:16: flow: z=&y:
./main.go:17:16: from &y (address-of) at ./main.go:18:8
./main.go:17:16: from z.M =&y (assign) at ./main.go:18:6
./main.go:17:16: moved to heap: y
# ...
➜ p8 go build -gcflags '-m -m -l' main.go
# command-line-arguments./main.go:8:14: make([]int, 100) does not escape
./main.go:15:14: make([]int, 1000000) escapes to heap:
./main.go:15:14: flow: {heap}=&{storage for make([]int, 1000000)}:
./main.go:15:14: from make([]int, 1000000)(too large for stack) at ./main.go:15:14
./main.go:15:14: make([]int, 1000000) escapes to heap
./main.go:23:11: make([]int, number) escapes to heap:
./main.go:23:11: flow: {heap}=&{storage for make([]int, number)}:
./main.go:23:11: from make([]int, number)(non-constant size) at ./main.go:23:11
./main.go:23:11: make([]int, number) escapes to heap
➜ p8 go build -gcflags '-m -m -l' main.go
# command-line-arguments./main.go:21:10: parameter y leaks to {heap} with derefs=0:
./main.go:21:10: flow: {heap}= y:
./main.go:21:10: from z.M = y (assign) at ./main.go:22:6
./main.go:21:10: leaking param: y
./main.go:21:18: z does not escape
./main.go:25:18: z does not escape
./main.go:28:11: y does not escape
./main.go:28:19: z does not escape
./main.go:13:6: i escapes to heap:
./main.go:13:6: flow: {heap}=&i:
./main.go:13:6: from &i (address-of) at ./main.go:15:6
./main.go:13:6: from ref(&i, &x)(call parameter) at ./main.go:15:5
./main.go:13:6: moved to heap: i
➜ p8 go run -gcflags '-m -m -l' main.go
# command-line-arguments./main.go:11:15: parameter z leaks to ~r0 with derefs=0:
./main.go:11:15: flow: ~r0 =&z:
./main.go:11:15: from &z (address-of) at ./main.go:12:9
./main.go:11:15: from return&z (return) at ./main.go:12:2
./main.go:11:15: z escapes to heap:
./main.go:11:15: flow: ~r0 =&z:
./main.go:11:15: from &z (address-of) at ./main.go:12:9
./main.go:11:15: from return&z (return) at ./main.go:12:2
./main.go:11:15: moved to heap: z
➜ p8 go run -gcflags '-m -m -l' main.go
# command-line-arguments./main.go:11:15: parameter z leaks to ~r0 with derefs=0:
./main.go:11:15: flow: ~r0 = z:
./main.go:11:15: from return z (return) at ./main.go:12:2
./main.go:11:15: leaking param: z to result ~r0 level=0