aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/mgc.go6
-rw-r--r--src/runtime/mgc_boring.go14
2 files changed, 20 insertions, 0 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index 604d0db24a..b2558c8bd3 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -1536,6 +1536,7 @@ func gcResetMarkState() {
// Hooks for other packages
var poolcleanup func()
+var boringCaches []unsafe.Pointer
//go:linkname sync_runtime_registerPoolCleanup sync.runtime_registerPoolCleanup
func sync_runtime_registerPoolCleanup(f func()) {
@@ -1548,6 +1549,11 @@ func clearpools() {
poolcleanup()
}
+ // clear boringcrypto caches
+ for _, p := range boringCaches {
+ atomicstorep(p, nil)
+ }
+
// Clear central sudog cache.
// Leave per-P caches alone, they have strictly bounded size.
// Disconnect cached list before dropping it on the floor,
diff --git a/src/runtime/mgc_boring.go b/src/runtime/mgc_boring.go
new file mode 100644
index 0000000000..149ba51dd7
--- /dev/null
+++ b/src/runtime/mgc_boring.go
@@ -0,0 +1,14 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build boringcrypto
+
+package runtime
+
+import "unsafe"
+
+//go:linkname boring_registerCache crypto/internal/boring.registerCache
+func boring_registerCache(p unsafe.Pointer) {
+ boringCaches = append(boringCaches, p)
+}