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 // Alloc is bytes of allocated heap objects.
13 //
14 // This is the same as HeapAlloc (see below).
15 Alloc uint64
16 17 // Sys is the total bytes of memory obtained from the OS.
18 //
19 // Sys is the sum of the XSys fields below. Sys measures the
20 // address space reserved by the runtime for the
21 // heap, stacks, and other internal data structures.
22 Sys uint64
23 24 // Heap memory statistics.
25 26 // HeapAlloc is bytes of allocated heap objects.
27 //
28 // "Allocated" heap objects include all reachable objects, as
29 // well as unreachable objects that the garbage collector has
30 // not yet freed. Specifically, HeapAlloc increases as heap
31 // objects are allocated and decreases as the heap is swept
32 // and unreachable objects are freed. Sweeping occurs
33 // incrementally between GC cycles, so these two processes
34 // occur simultaneously, and as a result HeapAlloc tends to
35 // change smoothly (in contrast with the sawtooth that is
36 // typical of stop-the-world garbage collectors).
37 HeapAlloc uint64
38 39 // HeapSys is bytes of heap memory, total.
40 //
41 // In Moxie unlike upstream Go, we make no distinction between
42 // regular heap blocks used by escaped-to-the-heap variables and
43 // blocks occupied by goroutine stacks,
44 // all such blocks are marked as in-use, see HeapInuse below.
45 HeapSys uint64
46 47 // HeapIdle is bytes in idle (unused) blocks.
48 HeapIdle uint64
49 50 // HeapInuse is bytes in in-use blocks.
51 HeapInuse uint64
52 53 // HeapReleased is bytes of physical memory returned to the OS.
54 HeapReleased uint64
55 56 // TotalAlloc is cumulative bytes allocated for heap objects.
57 //
58 // TotalAlloc increases as heap objects are allocated, but
59 // unlike Alloc and HeapAlloc, it does not decrease when
60 // objects are freed.
61 TotalAlloc uint64
62 63 // Mallocs is the cumulative count of heap objects allocated.
64 // The number of live objects is Mallocs - Frees.
65 Mallocs uint64
66 67 // Frees is the cumulative count of heap objects freed.
68 Frees uint64
69 70 // Off-heap memory statistics.
71 //
72 // The following statistics measure runtime-internal
73 // structures that are not allocated from heap memory (usually
74 // because they are part of implementing the heap).
75 76 // GCSys is bytes of memory in garbage collection metadata.
77 GCSys uint64
78 }
79