Skip to content

cmd/compile: allocation escapes to heap with "non-constant size" with constant size >= 64K #41635

@kipply

Description

@kipply

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

go version go1.14.2 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

// skipping

What did you do?

package main

func main() {
  thing := make([]byte, 65536) // also ran with 65535, which is < 64KiB 
}

Ran with go run -gcflags '-m -m' alloc.go

What did you expect to see?

message should say it escapes to heap because of a max value (not sure if this is an escape analysis impl determined value, or more related to my architecture or setup of the stack, or a mix of those)

What did you see instead?

./alloc.go:7:13: make([]byte, 65537) escapes to heap:
./alloc.go:7:13:   flow: {heap} = &{storage for make([]byte, 65537)}:
./alloc.go:7:13:     from make([]byte, 65537) (non-constant size) at ./alloc.go:7:13

it will not escape when I use 65535 instead of 65536.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions