/usr/local/go/src/runtime/mstats.go
Go divides the virtual address space of the heap into "spans", which are contiguous regions of memory 8K or larger. A span may be in one of three states:
-
idle, span contains no objects or other data, The physical memory backing an idle span can be released back to the OS (but the virtual address space never is), or it can be converted into an "in use" or "stack" span.
-
in use, contains at least one heap object and may have free space available to allocate more heap objects
-
stack, is used for goroutine stacks. Stack spans are not considered part of the heap. A span can change between heap and stack memory; it is never used for both simultaneously.
-
NextGC is the target heap size of the next GC cycle.
-
LastGC is the time the last garbage collection finished, as nanoseconds since 1970 (the UNIX epoch).
-
NumGC is the number of completed GC cycles.
-
NumForcedGC is the number of GC cycles that were forced by the application calling the GC function.
-
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
-
HeapSys is bytes of heap memory obtained from the OS. HeapSys estimates the largest size the heap has had.
-
HeapIdle is bytes in idle (unused) spans.
-
HeapInuse is bytes in in-use spans.
-
HeapReleased is bytes of physical memory returned to the OS.
-
HeapObjects is the number of allocated heap objects.
-
StackInuse is bytes in stack spans.
-
StackSys is bytes of stack memory obtained from the OS.
HeapIdle-HeapReleased=the amounts of memeory can be returned to the OS
Go 将堆的虚拟地址空间划分为“跨度”,跨度是 8K 或更大的连续内存区域。跨度可能处于以下三种状态之一:
-
空闲,跨度不包含任何对象或其他数据,支持空闲跨度的物理内存可以释放回操作系统(但虚拟地址空间永远不会释放),或者可以转换为“正在使用”或“堆栈”跨度。
-
正在使用,包含至少一个堆对象,并且可能有可用空间来分配更多堆对象
-
堆栈,用于 goroutine 堆栈。堆栈跨度不被视为堆的一部分。跨度可以在堆和堆栈内存之间切换;它永远不会同时用于两者。
-
HeapAlloc 是已分配堆对象的字节数。“已分配”堆对象包括所有可访问对象,以及垃圾收集器尚未释放的不可访问对象
-
HeapSys 是从操作系统获得的堆内存字节数。HeapSys 估计堆的最大大小。
-
HeapIdle 是空闲(未使用)跨度的字节数。HeapIdle-HeapReleased=可以返回到操作系统的内存量
-
HeapInuse 是正在使用跨度的字节数。
-
HeapReleased 是返回到操作系统的物理内存字节数。
-
HeapObjects 是已分配堆对象的数量。
-
StackInuse 是堆栈跨度的字节数。
-
StackSys 是从操作系统获得的堆栈内存字节数。
-
NextGC 是下一个 GC 周期的目标堆大小。
-
LastGC 是上次垃圾收集完成的时间,以纳秒为单位,自 1970 年(UNIX 纪元)以来。
-
NumGC 是已完成的 GC 周期数。
-
NumForcedGC 是应用程序调用 GC 函数强制执行的 GC 周期数。