文章目录
Golang 的 runtime 包可以用来检测内存的使用情况,主要内存使用情况,都在 MemStats 结构体里面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| type MemStats struct { Alloc uint64 TotalAlloc uint64 Sys uint64 Lookups uint64 Mallocs uint64 Frees uint64
HeapAlloc uint64 HeapSys uint64 HeapIdle uint64 HeapInuse uint64 HeapReleased uint64 HeapObjects uint64
StackInuse uint64 StackSys uint64 MSpanInuse uint64 MSpanSys uint64 MCacheInuse uint64 MCacheSys uint64 BuckHashSys uint64 GCSys uint64 OtherSys uint64
NextGC uint64 LastGC uint64 PauseTotalNs uint64 PauseNs [256]uint64 PauseEnd [256]uint64 NumGC uint32 EnableGC bool DebugGC bool
BySize [61]struct { Size uint32 Mallocs uint64 Frees uint64 } }
|