From 4ce2612f21d2c32fc8a6f7bbd2c6c6c5b807f4fe Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Thu, 2 Apr 2026 11:41:02 -0400 Subject: 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 Auto-Submit: Michael Pratt Reviewed-by: Michael Knyszek --- src/runtime/mem.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/runtime') 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. // -- cgit v1.3