runtime: add MemStats.TotalAlloc

This commit is contained in:
Damian Gryski
2022-08-09 14:03:19 -07:00
committed by Ron Evans
parent b56baa7aad
commit a87e5cdbf0
5 changed files with 17 additions and 1 deletions
+2 -1
View File
@@ -9,10 +9,11 @@ package runtime
// call to ReadMemStats. This would not do GC implicitly for you.
func ReadMemStats(m *MemStats) {
m.HeapIdle = 0
m.HeapInuse = uint64(heapptr - heapStart)
m.HeapInuse = gcTotalAlloc
m.HeapReleased = 0 // always 0, we don't currently release memory back to the OS.
m.HeapSys = m.HeapInuse + m.HeapIdle
m.GCSys = 0
m.TotalAlloc = gcTotalAlloc
m.Sys = uint64(heapEnd - heapStart)
}