Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: non-inlineable allocating function in closure causes closure to allocate #25769
It appears that inside a closure, if a function cannot be inlined and that function allocates, the closure will be allocated. This may be as intended (if so, sorry!), but it feels as if allocations in functions inside closures should be an orthogonal concern to the allocation of the closure itself.
What version of Go are you using (
The allocation seems to be dependent on the closure capturing a variable and a function in the closure potentially allocating. This code, ran in a benchmark, allocates:
Deleting setting either i1 or i2 from T inside the closure removes the allocation.