src/runtime: reset heapptr to heapStart after preinit()

heapptr is assinged to heapStart (which is 0) when it's declared, but preinit()
may have moved the heap somewhere else.  Set heapptr to the proper value
of heapStart when we initialize the heap properly.

This allows the leaking allocator to work on unix.
This commit is contained in:
Damian Gryski
2021-09-03 16:30:32 -07:00
committed by Ron Evans
parent 4b1f92600f
commit 5fa1e7163a
+2 -1
View File
@@ -52,7 +52,8 @@ func SetFinalizer(obj interface{}, finalizer interface{}) {
}
func initHeap() {
// Nothing to initialize.
// preinit() may have moved heapStart; reset heapptr
heapptr = heapStart
}
// setHeapEnd sets a new (larger) heapEnd pointer.