aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime
diff options
context:
space:
mode:
authorBCG <[email protected]>2023-02-01 07:49:26 -0500
committerDamian Gryski <[email protected]>2024-10-07 19:23:49 -0700
commitc77ed8e50ee3583ba4e45dfa044abfad075d47f5 (patch)
treed40d2107e293d8ac0e60b06c105505c024c51837 /src/runtime
parentd1b7238a36738f2b8359cd907ef9c2b9fce28c28 (diff)
downloadtinygo-c77ed8e50ee3583ba4e45dfa044abfad075d47f5.tar.gz
tinygo-c77ed8e50ee3583ba4e45dfa044abfad075d47f5.zip
Added mstats fields
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/mstats.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go
index 2699e08b3..7a6f8e637 100644
--- a/src/runtime/mstats.go
+++ b/src/runtime/mstats.go
@@ -9,6 +9,11 @@ package runtime
type MemStats struct {
// General statistics.
+ // Alloc is bytes of allocated heap objects.
+ //
+ // This is the same as HeapAlloc (see below).
+ Alloc uint64
+
// Sys is the total bytes of memory obtained from the OS.
//
// Sys is the sum of the XSys fields below. Sys measures the
@@ -18,6 +23,19 @@ type MemStats struct {
// Heap memory statistics.
+ // HeapAlloc is bytes of allocated heap objects.
+ //
+ // "Allocated" heap objects include all reachable objects, as
+ // well as unreachable objects that the garbage collector has
+ // not yet freed. Specifically, HeapAlloc increases as heap
+ // objects are allocated and decreases as the heap is swept
+ // and unreachable objects are freed. Sweeping occurs
+ // incrementally between GC cycles, so these two processes
+ // occur simultaneously, and as a result HeapAlloc tends to
+ // change smoothly (in contrast with the sawtooth that is
+ // typical of stop-the-world garbage collectors).
+ HeapAlloc uint64
+
// HeapSys is bytes of heap memory, total.
//
// In TinyGo unlike upstream Go, we make no distinction between