diff options
-rw-r--r-- | src/runtime/malloc.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 353f84083f..a8a5d48b5d 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -411,7 +411,10 @@ func mHeap_SysAlloc(h *mheap, n uintptr) unsafe.Pointer { h.arena_used = used h.arena_reserved = reserved } else { - var stat uint64 + // We haven't added this allocation to + // the stats, so subtract it from a + // fake stat (but avoid underflow). + stat := uint64(p_size) sysFree((unsafe.Pointer)(p), p_size, &stat) } } |