Skip to content

Commit e88be8a

Browse files
brandb97randall77
authored andcommitted
runtime: fix stale comment for mheap/malloc
mheap use pageAlloc to manage free/scav address space instead of using free/scav treap. The comment on mheap states mheap uses treaps. Update the comment to reflect the use of pageAlloc. In the fallback code when sizeSpecializedMalloc is enabled, heapBitsInSpan is false. Update the comment to reflect that. Change-Id: I50d2993c84e2c0312a925ab0a33065cc4cd41c41 Reviewed-on: https://go-review.googlesource.com/c/go/+/722700 Reviewed-by: Lidong Yan <yldhome2d2@gmail.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Mark Freeman <markfreeman@google.com>
1 parent a318843 commit e88be8a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/runtime/malloc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
11691169
var x unsafe.Pointer
11701170
var elemsize uintptr
11711171
if sizeSpecializedMallocEnabled {
1172-
// we know that heapBitsInSpan is true.
1172+
// we know that heapBitsInSpan is false.
11731173
if size <= maxSmallSize-gc.MallocHeaderSize {
11741174
if typ == nil || !typ.Pointers() {
11751175
x, elemsize = mallocgcSmallNoscan(size, typ, needzero)

src/runtime/mheap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const (
5656
)
5757

5858
// Main malloc heap.
59-
// The heap itself is the "free" and "scav" treaps,
59+
// The heap use pageAlloc to manage free and scavenged pages,
6060
// but all the other global data is here too.
6161
//
6262
// mheap must not be heap-allocated because it contains mSpanLists,

0 commit comments

Comments
 (0)