]> Cypherpunks repositories - gostls13.git/commit
runtime: add new GODEBUG checkfinalizer
authorMichael Anthony Knyszek <mknyszek@google.com>
Mon, 9 Dec 2024 19:07:40 +0000 (19:07 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 20 May 2025 17:37:12 +0000 (10:37 -0700)
commit3df078fc74a550168440d5afd5f9a9204b77f0f9
treeb59b10a2cbc4e09c5f12ad6b10d4703eaca24960
parent2a65100e68cd82172b214a4d12cd2586c0b9ef99
runtime: add new GODEBUG checkfinalizer

This new debug mode detects cleanup/finalizer leaks using checkmark
mode. It runs a partial GC using only specials as roots. If the GC can
find a path from one of these roots back to the object the special is
attached to, then the object might never be reclaimed. (The cycle could
be broken in the future, but it's almost certainly a bug.)

This debug mode is very barebones. It contains no type information and
no stack location for where the finalizer or cleanup was created.

For #72949.

Change-Id: Ibffd64c1380b51f281950e4cfe61f677385d42a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/634599
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
src/runtime/gc_test.go
src/runtime/mcheckmark.go
src/runtime/mgc.go
src/runtime/mgcmark.go
src/runtime/mheap.go
src/runtime/runtime1.go
src/runtime/testdata/testprog/checkfinalizers.go [new file with mode: 0644]