-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Using go1.17.5
.
In the following snippet:
bb := &Buffer{buf: make([]byte, 0, 64)}
bb.buf = append(bb.buf)
the buffer for make([]byte, 0, 64)
escapes to the heap because escape analysis cannot seem to determine that bb.buf = append(bb.buf)
does not cause buf
to escape.
I expect the code above to be able to stack allocate make([]byte, 0, 64)
.
\cc @josharian @mdempsky
@josharian theorizes that we might need a special case in https://github.com/golang/go/blame/master/src/cmd/compile/internal/escape/utils.go
mvdan, mengzhuo, thesyncim, josharian and FiloSottile
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Triage Backlog