Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: escape analysis on slice allocations #39793

hagaidayan opened this issue Jun 23, 2020 · 2 comments

cmd/compile: escape analysis on slice allocations #39793

hagaidayan opened this issue Jun 23, 2020 · 2 comments


Copy link

@hagaidayan hagaidayan commented Jun 23, 2020

What version of Go are you using (go version)?

$ go version 1.13

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

2.3 GHz Dual-Core Intel Core i5


go env Output
$ go env

What did you do?

I wrote 2 similar programs that do the same thing
then built them with ' go build -gcflags "-m -m -l -N" '

func main () {
x := 10
arr := make([]int, x)
arr[0] = 0

func main () {
arr := make([]int, 10)
arr[0] = 0

What did you expect to see?

that both programs either do, or do not produce heap allocations

What did you see instead?

program A escapes to heap in line 3, while program B doesn't

Copy link

@randall77 randall77 commented Jun 23, 2020

Probably a dup of #29095

Copy link

@cagedmantis cagedmantis commented Jun 29, 2020

As mentioned above this issue is captured in #29095. Please feel free to comment if you feel this was closed in error.

@golang golang locked and limited conversation to collaborators Jun 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

4 participants