From: Austin Clements Date: Fri, 25 Sep 2020 00:58:33 +0000 (-0400) Subject: runtime: update go:notinheap documentation X-Git-Tag: go1.16beta1~930 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2e0f8c379f91f77272d096929cf22391b64d0e34;p=gostls13.git 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 --- 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