diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2025-05-09 18:53:06 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-05-20 11:15:12 -0700 |
| commit | c58f58b9f8df0bde53bb5bc20b5ea97d34b1531d (patch) | |
| tree | 3d032baae8584ef335920ebc8febebffdfaa5927 /src/runtime/runtime1.go | |
| parent | 913c069819b77c0cfda78806654696508baf7f32 (diff) | |
| download | go-c58f58b9f8df0bde53bb5bc20b5ea97d34b1531d.tar.xz | |
runtime: mark and identify tiny blocks in checkfinalizers mode
This change adds support for identifying cleanups and finalizers
attached to tiny blocks to checkfinalizers mode. It also notes a subtle
pitfall, which is that the cleanup arg, if tiny-allocated, could end up
co-located with the object with the cleanup attached! Oops...
For #72949.
Change-Id: Icbe0112f7dcfc63f35c66cf713216796a70121ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/662037
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/runtime/runtime1.go')
| -rw-r--r-- | src/runtime/runtime1.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index 9a4e15c95e..975d401694 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -333,14 +333,14 @@ var debug struct { traceCheckStackOwnership int32 profstackdepth int32 dataindependenttiming int32 - checkfinalizers int32 // debug.malloc is used as a combined debug check // in the malloc function and should be set // if any of the below debug options is != 0. - malloc bool - inittrace int32 - sbrk int32 + malloc bool + inittrace int32 + sbrk int32 + checkfinalizers int32 // traceallocfree controls whether execution traces contain // detailed trace data about memory allocation. This value // affects debug.malloc only if it is != 0 and the execution @@ -440,7 +440,7 @@ func parsedebugvars() { // apply environment settings parsegodebug(godebug, nil) - debug.malloc = (debug.inittrace | debug.sbrk) != 0 + debug.malloc = (debug.inittrace | debug.sbrk | debug.checkfinalizers) != 0 debug.profstackdepth = min(debug.profstackdepth, maxProfStackDepth) // Disable async preemption in checkmark mode. The following situation is |
