From 0f3876f8c12ba3746a1dfec68422e9cce5c2ff39 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Thu, 11 Jan 2024 12:52:16 -0800 Subject: runtime: ensure we free unrolled GC bitmaps CL 555355 has a bug in it - the GC program flag was also used to decide when to free the unrolled bitmap. After that CL, we just don't free any unrolled bitmaps, leading to a memory leak. Use a separate flag to track types that need to be freed when their corresponding object is freed. Change-Id: I841b65492561f5b5e1853875fbd8e8a872205a84 Reviewed-on: https://go-review.googlesource.com/c/go/+/555416 Auto-Submit: Keith Randall Reviewed-by: Michael Knyszek Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI --- src/runtime/mbitmap_allocheaders.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/runtime/mbitmap_allocheaders.go') diff --git a/src/runtime/mbitmap_allocheaders.go b/src/runtime/mbitmap_allocheaders.go index bc574ad689..1ec055352e 100644 --- a/src/runtime/mbitmap_allocheaders.go +++ b/src/runtime/mbitmap_allocheaders.go @@ -886,6 +886,7 @@ func heapSetType(x, dataSize uintptr, typ *_type, header **_type, span *mspan) ( gctyp.Size_ = typ.Size_ gctyp.PtrBytes = typ.PtrBytes gctyp.GCData = (*byte)(add(unsafe.Pointer(progSpan.base()), heapBitsOff)) + gctyp.TFlag = abi.TFlagUnrolledBitmap // Expand the GC program into space reserved at the end of the new span. runGCProg(addb(typ.GCData, 4), gctyp.GCData) -- cgit v1.3