runtime: heapptr only needs to be initialized once

There is no need to initialize it twice.
This commit is contained in:
Ayke van Laethem
2024-11-18 09:30:39 +01:00
committed by Ayke
parent 9b3eb3fe59
commit 8068419854
+3 -2
View File
@@ -11,7 +11,7 @@ import (
)
// Ever-incrementing pointer: no memory is freed.
var heapptr = heapStart
var heapptr uintptr
// Total amount allocated for runtime.MemStats
var gcTotalAlloc uint64
@@ -93,7 +93,8 @@ func SetFinalizer(obj interface{}, finalizer interface{}) {
}
func initHeap() {
// preinit() may have moved heapStart; reset heapptr
// Initialize this bump-pointer allocator to the start of the heap.
// Needed here because heapStart may not be a compile-time constant.
heapptr = heapStart
}