mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 23:13:40 +00:00
runtime: make MemStats available to leaking collector
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
//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)
|
||||
}
|
||||
Reference in New Issue
Block a user