tinygo/src/runtime/mstats_leaking.go

18 строки
507 Б
Go

//go:build gc.leaking
// +build gc.leaking
package runtime
// ReadMemStats populates m with memory statistics.
//
// The returned memory statistics are up to date as of the
// call to ReadMemStats. This would not do GC implicitly for you.
func ReadMemStats(m *MemStats) {
m.HeapIdle = 0
m.HeapInuse = uint64(heapptr - heapStart)
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.Sys = uint64(heapEnd - heapStart)
}