You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runtime: g is allocated from the 480-byte size class on amd64, arm64 and loong64 #82000
Since CL 704615 (runtime/secret) added g.secret, unsafe.Sizeof(g{}) is 456 bytes on amd64, arm64 and loong64, so every g is allocated from the 480-byte size class. Before that change it was exactly 448 bytes.
g.valgrindStackID (8 bytes) is only used with the valgrind build tag, but every g has it. Moving it into a type that is empty without the build tag, the way xRegPerG is, makes g 448 bytes again on those platforms, and it stays 456 bytes with -tags valgrind.
On darwin/arm64 (Apple M2 Pro) with 100,000 parked goroutines, heap in use per goroutine drops from 639.1 to 609.0 bytes, and each g is allocated from the 448-byte class instead of the 480-byte class.
Separately, CL 843525 removes g.stackLock, which has been unused since CL 36620. It does not change the size class by itself, but together the two changes leave room for a future small field.
Activity
gopherbot commentedon Oct 4, 2026
Change https://go.dev/cl/844725 mentions this issue:
runtime: only reserve g.valgrindStackID in valgrind buildsgabyhelp commentedon Oct 4, 2026
Related Code Changes
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
runtime: report size class changes in TestSizeof
gopherbot commentedon Oct 5, 2026
Change https://go.dev/cl/844825 mentions this issue:
runtime: report size class changes in TestSizeofdmitshur commentedon Oct 5, 2026
CC @golang/runtime.
runtime: report size class changes in TestSizeof