github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/mstats.go (about) 1 package runtime 2 3 // Memory statistics 4 5 // Subset of memory statistics from upstream Go. 6 // Works with conservative gc only. 7 8 // A MemStats records statistics about the memory allocator. 9 type MemStats struct { 10 // General statistics. 11 12 // Sys is the total bytes of memory obtained from the OS. 13 // 14 // Sys is the sum of the XSys fields below. Sys measures the 15 // address space reserved by the runtime for the 16 // heap, stacks, and other internal data structures. 17 Sys uint64 18 19 // Heap memory statistics. 20 21 // HeapSys is bytes of heap memory, total. 22 // 23 // In TinyGo unlike upstream Go, we make no distinction between 24 // regular heap blocks used by escaped-to-the-heap variables and 25 // blocks occupied by goroutine stacks, 26 // all such blocks are marked as in-use, see HeapInuse below. 27 HeapSys uint64 28 29 // HeapIdle is bytes in idle (unused) blocks. 30 HeapIdle uint64 31 32 // HeapInuse is bytes in in-use blocks. 33 HeapInuse uint64 34 35 // HeapReleased is bytes of physical memory returned to the OS. 36 HeapReleased uint64 37 38 // TotalAlloc is cumulative bytes allocated for heap objects. 39 // 40 // TotalAlloc increases as heap objects are allocated, but 41 // unlike Alloc and HeapAlloc, it does not decrease when 42 // objects are freed. 43 TotalAlloc uint64 44 45 // Mallocs is the cumulative count of heap objects allocated. 46 // The number of live objects is Mallocs - Frees. 47 Mallocs uint64 48 49 // Frees is the cumulative count of heap objects freed. 50 Frees uint64 51 52 // Off-heap memory statistics. 53 // 54 // The following statistics measure runtime-internal 55 // structures that are not allocated from heap memory (usually 56 // because they are part of implementing the heap). 57 58 // GCSys is bytes of memory in garbage collection metadata. 59 GCSys uint64 60 }