diff options
author | Ayke van Laethem <[email protected]> | 2024-11-18 09:30:39 +0100 |
---|---|---|
committer | Ayke van Laethem <[email protected]> | 2024-11-18 11:56:41 +0100 |
commit | cac4a145735ae319b7ca81690d2ddeadf009bb57 (patch) | |
tree | 4d2fde26c9932f7369afad6f20ebefe0472b1448 | |
parent | 258dac23247209dc54a2a986da9205549600d487 (diff) | |
download | tinygo-cac4a145735ae319b7ca81690d2ddeadf009bb57.tar.gz tinygo-cac4a145735ae319b7ca81690d2ddeadf009bb57.zip |
runtime: heapptr only needs to be initialized oncegc-leaking-init
There is no need to initialize it twice.
-rw-r--r-- | src/runtime/gc_leaking.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/runtime/gc_leaking.go b/src/runtime/gc_leaking.go index 71c4258b6..a40602a98 100644 --- a/src/runtime/gc_leaking.go +++ b/src/runtime/gc_leaking.go @@ -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 } |