sync/atomic: add //go:noescape
to atomic functions accepting pointer
#36651
Labels
//go:noescape
to atomic functions accepting pointer
#36651
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes, it is reproducible in
go1.13
andgo tip
.What did you do?
Run the following benchmark:
What did you expect to see?
Zero memory allocations in the benchmark loop.
What did you see instead?
A memory allocation. The following is the output from
go tool pprof --alloc_objects
:It looks like Go compiler thinks that args passed to
sync/atomic
functions may escape.Possible solution is to add
//go:noescape
to these functions.The text was updated successfully, but these errors were encountered: