You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At b85fa2d, in this file, both BenchmarkBad and BenchmarkGood causes []byte("Hello world") escape to heap:
$ go test -c -gcflags=-m p_test.go
# command-line-arguments [command-line-arguments.test]
./p_test.go:8:19: b does not escape
./p_test.go:11:14: ([]byte)("Hello world") escapes to heap
./p_test.go:14:13: ... argument does not escape
./p_test.go:14:14: a escapes to heap
./p_test.go:17:20: b does not escape
./p_test.go:19:17: ([]byte)("Hello world") escapes to heap
./p_test.go:23:13: ... argument does not escape
./p_test.go:23:14: a escapes to heap
# command-line-arguments.test
_testmain.go:39:6: can inline init.0
_testmain.go:47:24: inlining call to testing.MainStart
_testmain.go:47:42: testdeps.TestDeps{} escapes to heap
_testmain.go:47:24: &testing.M{...} escapes to heap
The reason BenchmarkBad is worse because the escaping happens inside the loop, it does not relate to string to bytes conversion operation.
The text was updated successfully, but these errors were encountered:
At b85fa2d, in this file, both
BenchmarkBad
andBenchmarkGood
causes[]byte("Hello world")
escape to heap:The reason
BenchmarkBad
is worse because the escaping happens inside the loop, it does not relate to string to bytes conversion operation.The text was updated successfully, but these errors were encountered: