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.
Этот коммит содержится в:
Damian Gryski 2021-09-03 16:30:32 -07:00 коммит произвёл Ron Evans
родитель 4b1f92600f
коммит 5fa1e7163a

Просмотреть файл

@ -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.