Nhảy tới nội dung
This page uses machine translation from English, which may contain errors or unclear language. For the most accurate information, please see the original English version. Some content may be in the original English due to frequent updates. Help us improve this page's translation by joining our effort on Crowdin. (Crowdin translation page, Contributing guide)

[runtimeDebug] debug_memStats

Returns detailed runtime memory statistics.

JSONRPC: debug_memStats

Request

Body

    params array

Responses

Returns detailed runtime memory statistics.

Schema

    error

    object

    code int64required

    A Number that indicates the error type that occurred. This MUST be an integer.

    codemessagedescription
    -32700Parse errorinvalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
    -32602Invalid paramsInvalid method parameter(s).
    message string

    A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.

    data string

    A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).

    result

    object

    Returns detailed runtime memory statistics.

    Alloc stringrequired

    Alloc is bytes of allocated heap objects. This is the same as HeapAlloc

    TotalAlloc stringrequired

    TotalAlloc is cumulative bytes allocated for heap objects. TotalAlloc increases as heap objects are allocated, but unlike Alloc and HeapAlloc, it does not decrease when objects are freed.

    Sys stringrequired

    Sys is the total bytes of memory obtained from the OS. Sys is the sum of the XSys fields below. Sys measures the virtual address space reserved by the Go runtime for the heap, stacks, and other internal data structures. It's likely that not all of the virtual address space is backed by physical memory at any given moment, though in general it all was at some point.

    Lookups stringrequired

    Lookups is the number of pointer lookups performed by the runtime. This is primarily useful for debugging runtime internals

    Mallocs stringrequired

    Mallocs is the cumulative count of heap objects allocated. The number of live objects is Mallocs - Frees.

    Frees stringrequired

    Frees is the cumulative count of heap objects freed.

    HeapAlloc stringrequired

    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).

    HeapSys stringrequired

    HeapSys is bytes of heap memory obtained from the OS. HeapSys measures the amount of virtual address space reserved for the heap. This includes virtual address space that has been reserved but not yet used, which consumes no physical memory, but tends to be small, as well as virtual address space for which the physical memory has been returned to the OS after it became unused (see HeapReleased for a measure of the latter). HeapSys estimates the largest size the heap has had.

    HeapIdle stringrequired

    HeapIdle is bytes in idle (unused) spans. Idle spans have no objects in them. These spans could be (and may already have been) returned to the OS, or they can be reused for heap allocations, or they can be reused as stack memory. HeapIdle minus HeapReleased estimates the amount of memory that could be returned to the OS, but is being retained by the runtime so it can grow the heap without requesting more memory from the OS. If this difference is significantly larger than the heap size, it indicates there was a recent transient spike in live heap size.

    HeapInuse stringrequired

    HeapInuse is bytes in in-use spans. In-use spans have at least one object in them. These spans can only be used for other objects of roughly the same size. HeapInuse minus HeapAlloc estimates the amount of memory that has been dedicated to particular size classes, but is not currently being used. This is an upper bound on fragmentation, but in general this memory can be reused efficiently.

    HeapReleased stringrequired

    HeapReleased is bytes of physical memory returned to the OS. This counts heap memory from idle spans that was returned to the OS and has not yet been reacquired for the heap.

    HeapObjects stringrequired

    HeapObjects is the number of allocated heap objects. Like HeapAlloc, this increases as objects are allocated and decreases as the heap is swept and unreachable objects are freed

    StackInuse stringrequired

    StackInuse is bytes in stack spans. In-use stack spans have at least one stack in them. These spans can only be used for other stacks of the same size. There is no StackIdle because unused stack spans are returned to the heap (and hence counted toward HeapIdle).

    StackSys stringrequired

    StackSys is bytes of stack memory obtained from the OS. StackSys is StackInuse, plus any memory obtained directly from the OS for OS thread stacks (which should be minimal).

    MSpanSys stringrequired

    MSpanSys is bytes of memory obtained from the OS for mspan structures.

    MSpanInuse stringrequired

    MCacheInuse is bytes of allocated mcache structures.

    MCacheSys stringrequired

    MCacheSys is bytes of memory obtained from the OS for mcache structures.

    BuckHashSys stringrequired

    BuckHashSys is bytes of memory in profiling bucket hash tables.

    GCSys stringrequired

    GCSys is bytes of memory in garbage collection metadata.

    OtherSys stringrequired

    OtherSys is bytes of memory in miscellaneous off-heap runtime allocations.

    NextGC stringrequired

    NextGC is the target heap size of the next GC cycle. The garbage collector's goal is to keep HeapAlloc ≤ NextGC. At the end of each GC cycle, the target for the next cycle is computed based on the amount of reachable data and the value of GOGC.

    LastGC stringrequired

    LastGC is the time the last garbage collection finished, as nanoseconds since 1970 (the UNIX epoch).

    PauseTotalNs stringrequired

    PauseTotalNs is the cumulative nanoseconds in GC stop-the-world pauses since the program started. During a stop-the-world pause, all goroutines are paused and only the garbage collector can run.

    PauseNs string[]required

    PauseNs is a circular buffer of recent GC stop-the-world pause times in nanoseconds. The most recent pause is at PauseNs[(NumGC+255)%256]. In general, PauseNs[N%256] records the time paused in the most recent N%256th GC cycle. There may be multiple pauses per GC cycle; this is the sum of all pauses during a cycle.

    PauseEnd string[]required

    PauseEnd is a circular buffer of recent GC pause end times, as nanoseconds since 1970 (the UNIX epoch). This buffer is filled the same way as PauseNs. There may be multiple pauses per GC cycle; this records the end of the last pause in a cycle.

    NumGC stringrequired

    NumGC is the number of completed GC cycles.

    NumForcedGC stringrequired

    NumForcedGC is the number of GC cycles that were forced by the application calling the GC function.

    GCCPUFraction stringrequired

    GCCPUFraction is the fraction of this program's available CPU time used by the GC since the program started. GCCPUFraction is expressed as a number between 0 and 1, where 0 means GC has consumed none of this program's CPU. A program's available CPU time is defined as the integral of GOMAXPROCS since the program started. That is, if GOMAXPROCS is 2 and a program has been running for 10 seconds, its "available CPU" is 20 seconds. GCCPUFraction does not include CPU time used for write barrier activity. This is the same as the fraction of CPU reported by GODEBUG=gctrace=1.

    EnableGC booleanrequired

    EnableGC indicates that GC is enabled. It is always true, even if GOGC=off.

    DebugGC booleanrequired

    DebugGC is currently unused.

    BySize

    object[]

    required

    BySize reports per-size class allocation statistics. BySize[N] gives statistics for allocations of size S where BySize[N-1].Size < S ≤ BySize[N].Size. This does not report allocations larger than BySize[60].Size.

  • Array [

  • Size string

    Size is the maximum byte size of an object in this size class.

    Mallocs string

    Mallocs is the cumulative count of heap objects allocated in this size class. The cumulative bytes of allocation is Size*Mallocs. The number of live objects in this size class is Mallocs - Frees.

    Frees string

    Frees is the cumulative count of heap objects freed in this size class.

  • ]

Loading...
Cải thiện trang này