aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2026-04-02 11:41:02 -0400
committerGopher Robot <gobot@golang.org>2026-04-02 13:18:04 -0700
commit4ce2612f21d2c32fc8a6f7bbd2c6c6c5b807f4fe (patch)
tree53cfdf88ba6a94fb458d807e2f2584ff07ac6436
parentcaa169ee4804ba0dbe1c430e8e9a4d2940f5145b (diff)
downloadgo-4ce2612f21d2c32fc8a6f7bbd2c6c6c5b807f4fe.tar.xz
runtime: clarify sysFree documentation
sysFree decrements mappedReady since CL 393402, meaning it can only be used on Ready memory, not any memory as stated. The example uses are not relevant as those cases would not necessarily be Ready memory. The no-op note is meant to be relevant to sysReserveAligned, but that doesn't use sysFree anyway. Change-Id: I3aeb0e703b0a57202a01317e0904cd966a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/762380 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
-rw-r--r--src/runtime/mem.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/runtime/mem.go b/src/runtime/mem.go
index f373173eb3..077c5f112b 100644
--- a/src/runtime/mem.go
+++ b/src/runtime/mem.go
@@ -111,12 +111,8 @@ func sysHugePageCollapse(v unsafe.Pointer, n uintptr) {
sysHugePageCollapseOS(v, n)
}
-// sysFree transitions a memory region from any state to None. Therefore, it
-// returns memory unconditionally. It is used if an out-of-memory error has been
-// detected midway through an allocation or to carve out an aligned section of
-// the address space. It is okay if sysFree is a no-op only if sysReserve always
-// returns a memory region aligned to the heap allocator's alignment
-// restrictions.
+// sysFree transitions a memory region from Ready to None. Therefore, it
+// returns memory unconditionally.
//
// sysStat must be non-nil.
//