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

Closed
hagaidayan opened this issue Jun 23, 2020 · 2 comments
Closed

cmd/compile: escape analysis on slice allocations #39793

hagaidayan opened this issue Jun 23, 2020 · 2 comments

Comments

@hagaidayan
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?

yes

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

2.3 GHz Dual-Core Intel Core i5

Mac OSX

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" '

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

B.
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

@randall77
Copy link
Contributor

@randall77 randall77 commented Jun 23, 2020

Probably a dup of #29095

@cagedmantis
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.