What version of Go are you using (go version)?
$ go version
go version go1.16.5 linux/amd64
Does this issue reproduce with the latest release?
Yes
What did you do?
package concat
import (
"testing"
)
var s33 = []byte{32: 'b'}
var a = string(s33)
func Benchmark_e_33(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = a + a // a + a does not escape
}
}
What did you expect to see?
No allocations. Or says "a + a escapes to heap"
What did you see instead?
$ go test -gcflags=-m
..
./concat_test.go:13:15: a + a does not escape
..
$ go test -bench=. -benchmem
...
Benchmark_e_33-4 14399670 75.39 ns/op 80 B/op 1 allocs/op
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What did you do?
What did you expect to see?
No allocations. Or says "a + a escapes to heap"
What did you see instead?