1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
9 type MemStatsType struct {
10 // General statistics.
11 // Not locked during update; approximate.
12 Alloc uint64 // bytes allocated and still in use
13 TotalAlloc uint64 // bytes allocated (even if freed)
14 Sys uint64 // bytes obtained from system (should be sum of XxxSys below)
15 Lookups uint64 // number of pointer lookups
16 Mallocs uint64 // number of mallocs
17 Frees uint64 // number of frees
19 // Main allocation heap statistics.
20 HeapAlloc uint64 // bytes allocated and still in use
21 HeapSys uint64 // bytes obtained from system
22 HeapIdle uint64 // bytes in idle spans
23 HeapInuse uint64 // bytes in non-idle span
24 HeapObjects uint64 // total number of allocated objects
26 // Low-level fixed-size structure allocator statistics.
27 // Inuse is bytes used now.
28 // Sys is bytes obtained from system.
29 StackInuse uint64 // bootstrap stacks
31 MSpanInuse uint64 // mspan structures
33 MCacheInuse uint64 // mcache structures
35 BuckHashSys uint64 // profiling bucket hash table
37 // Garbage collector statistics.
40 PauseNs [256]uint64 // most recent GC pause times
45 // Per-size allocation statistics.
46 // Not locked during update; approximate.
47 // 61 is NumSizeClasses in the C code.
55 var Sizeof_C_MStats int // filled in by malloc.goc
58 if Sizeof_C_MStats != unsafe.Sizeof(MemStats) {
59 println(Sizeof_C_MStats, unsafe.Sizeof(MemStats))
60 panic("MStats vs MemStatsType size mismatch")
64 // MemStats holds statistics about the memory system.
65 // The statistics are only approximate, as they are not interlocked on update.
66 var MemStats MemStatsType
68 // GC runs a garbage collection.