diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2025-04-02 01:46:45 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-05-20 12:05:59 -0700 |
| commit | 5b0b4c01ba44f372343ed003b297f50ee3c8ff67 (patch) | |
| tree | 6e44fa27167bef2e09b4e739721a061e38bd4cc3 /src/runtime | |
| parent | 0d42cebacdba1855d11f29f708587c9a7a5cb976 (diff) | |
| download | go-5b0b4c01ba44f372343ed003b297f50ee3c8ff67.tar.xz | |
runtime: add package doc for checkfinalizer mode
Fixes #72949.
Change-Id: I114eda73c57bc7d596eb1656e738b80c1cbe5254
Reviewed-on: https://go-review.googlesource.com/c/go/+/662039
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/extern.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/runtime/extern.go b/src/runtime/extern.go index eb30b0566e..62dab74bc0 100644 --- a/src/runtime/extern.go +++ b/src/runtime/extern.go @@ -52,6 +52,21 @@ It is a comma-separated list of name=val pairs setting these named variables: cgocheck mode can be enabled using GOEXPERIMENT (which requires a rebuild), see https://pkg.go.dev/internal/goexperiment for details. + checkfinalizers: setting checkfinalizers=1 causes the garbage collector to run + multiple partial non-parallel stop-the-world collections to identify common issues with + finalizers and cleanups, like those listed at + https://go.dev/doc/gc-guide#Finalizers_cleanups_and_weak_pointers. If a potential issue + is found, the program will terminate with a description of all potential issues, the + associated values, and a list of those values' finalizers and cleanups, including where + they were created. It also adds tracking for tiny blocks to help diagnose issues with + those as well. The analysis performed during the partial collection is conservative. + Notably, it flags any path back to the original object from the cleanup function, + cleanup arguments, or finalizer function as a potential issue, even if that path might + be severed sometime later during execution (though this is not a recommended pattern). + This mode also produces one line of output to stderr every GC cycle with information + about the finalizer and cleanup queue lengths. Lines produced by this mode start with + "checkfinalizers:". + decoratemappings: controls whether the Go runtime annotates OS anonymous memory mappings with context about their purpose. These annotations appear in /proc/self/maps and /proc/self/smaps as |
