From 2e0f8c379f91f77272d096929cf22391b64d0e34 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 24 Sep 2020 20:58:33 -0400 Subject: [PATCH] runtime: update go:notinheap documentation The rules for go:notinheap were recently tweaked to disallow stack allocation (CL 249917). This CL updates the documentation about go:notinheap in runtime/HACKING.md. Change-Id: Ibca5d9b9d02e1c22c6af1d303aa84c6303a86d92 Reviewed-on: https://go-review.googlesource.com/c/go/+/257357 Trust: Austin Clements Reviewed-by: Keith Randall --- src/runtime/HACKING.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/runtime/HACKING.md b/src/runtime/HACKING.md index 993edc67d8..fbf22eeb44 100644 --- a/src/runtime/HACKING.md +++ b/src/runtime/HACKING.md @@ -281,11 +281,12 @@ go:notinheap ------------ `go:notinheap` applies to type declarations. It indicates that a type -must never be allocated from the GC'd heap. Specifically, pointers to -this type must always fail the `runtime.inheap` check. The type may be -used for global variables, for stack variables, or for objects in -unmanaged memory (e.g., allocated with `sysAlloc`, `persistentalloc`, -`fixalloc`, or from a manually-managed span). Specifically: +must never be allocated from the GC'd heap or on the stack. +Specifically, pointers to this type must always fail the +`runtime.inheap` check. The type may be used for global variables, or +for objects in unmanaged memory (e.g., allocated with `sysAlloc`, +`persistentalloc`, `fixalloc`, or from a manually-managed span). +Specifically: 1. `new(T)`, `make([]T)`, `append([]T, ...)` and implicit heap allocation of T are disallowed. (Though implicit allocations are