aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mbitmap_noallocheaders.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mbitmap_noallocheaders.go')
-rw-r--r--src/runtime/mbitmap_noallocheaders.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/mbitmap_noallocheaders.go b/src/runtime/mbitmap_noallocheaders.go
index 96c70a0970..dab15889a4 100644
--- a/src/runtime/mbitmap_noallocheaders.go
+++ b/src/runtime/mbitmap_noallocheaders.go
@@ -744,6 +744,11 @@ func getgcmask(ep any) (mask []byte) {
for len(mask) > 0 && mask[len(mask)-1] == 0 {
mask = mask[:len(mask)-1]
}
+
+ // Make sure we keep ep alive. We may have stopped referencing
+ // ep's data pointer sometime before this point and it's possible
+ // for that memory to get freed.
+ KeepAlive(ep)
return
}