]> Cypherpunks repositories - gostls13.git/commit
runtime: clarify g object vs stack memory lifetime in HACKING.md
authorkovan <xaum.io@gmail.com>
Tue, 3 Feb 2026 15:07:55 +0000 (16:07 +0100)
committerGopher Robot <gobot@golang.org>
Fri, 6 Feb 2026 17:26:53 +0000 (09:26 -0800)
commitb8be5de81ee78f51fbd600498093b542e75a710e
tree5fc0fbe908f15e3e329e4686f7ad14d6d1efa6ae
parentd4febb45179fa99ee1d5783bcb693ed7ba14115c
runtime: clarify g object vs stack memory lifetime in HACKING.md

The documentation states that g objects are "never freed" but does not
clarify that goroutine stack memory is managed separately. This can be
confusing as it might imply that all goroutine memory (including stacks)
is retained indefinitely.

Add a paragraph in the Stacks section clarifying that:
- Stack memory may be freed when a goroutine exits
- Stacks at the starting size are retained for reuse
- Grown stacks are freed and reallocated when needed
- The g object itself is never freed, only its stack memory

Fixes #65843

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change-Id: Icb3afbb5392401d695ab129c341ce10106e5a4f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/741505
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/runtime/HACKING.md