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
Even with a bytes.Buffer less than 64 bytes the Buffer always gets allocated to the
heap. I was quite surprised by this as bytes.Buffer contains "bootstrap
[64]byte" which is supposed to prevent this. Is that correct?
What does 'go version' print?
go version go1.2.1 darwin/amd64
go version devel +773ba5ac4f21 Fri Mar 28 11:30:02 2014 -0400 darwin/amd64
What steps reproduce the problem?
I've distilled the code in test.go
test.go: http://play.golang.org/p/DLzkUIN4a6
$ go build -gcflags=-m test.go
What happened?
# command-line-arguments
./test.go:8: can inline (*Buffer).Grow
./test.go:15: inlining call to (*Buffer).Grow
./test.go:9: b.bootstrap escapes to heap
./test.go:8: leaking param: b
./test.go:8: leaking param: b
./test.go:15: b.bootstrap escapes to heap
./test.go:14: moved to heap: myBuf
./test.go:15: myBuf escapes to heap
What should have happened instead?
b.bootstrap and myBuf should not escape to the heap
Please provide any additional information below.
This happens in Go 1.2.1 and tip.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: