Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit 496c5c4

Browse files
authored
Fix MemStats.Sys does not include GC heap (#4)
1 parent 66b19b3 commit 496c5c4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

gc.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ func ReadMemStats(ms *runtime.MemStats) {
8383

8484
gcOSBytes := C.GC_get_obtained_from_os_bytes()
8585

86-
// Since the GC delegates to malloc/free for underlying pages, the total memory occupied by both C malloc/free and
87-
// the GC is malloc's peak RSS itself. Because mimalloc does not return pages when run under wasm, peak/current RSS
88-
// and commit are all the same value and we only record one.
89-
ms.Sys = uint64(peakRSS)
86+
ms.Sys = uint64(peakRSS + gcOSBytes)
9087
ms.HeapSys = uint64(gcOSBytes)
9188
ms.HeapIdle = uint64(freeBytes)
9289
ms.HeapReleased = uint64(unmappedBytes)

0 commit comments

Comments
 (0)