Skip to content

Commit a3f4cc0

Browse files
committed
runtime: document MemStats.BySize fields
Change-Id: Iae8cdcd84e9b5f5d7c698abc6da3fc2af0ef839a Reviewed-on: https://go-review.googlesource.com/34710 Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
1 parent c8f1436 commit a3f4cc0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/runtime/mstats.go

+13-2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ type MemStats struct {
174174
Lookups uint64
175175

176176
// Mallocs is the cumulative count of heap objects allocated.
177+
// The number of live objects is Mallocs - Frees.
177178
Mallocs uint64
178179

179180
// Frees is the cumulative count of heap objects freed.
@@ -397,9 +398,19 @@ type MemStats struct {
397398
//
398399
// This does not report allocations larger than BySize[60].Size.
399400
BySize [61]struct {
400-
Size uint32
401+
// Size is the maximum byte size of an object in this
402+
// size class.
403+
Size uint32
404+
405+
// Mallocs is the cumulative count of heap objects
406+
// allocated in this size class. The cumulative bytes
407+
// of allocation is Size*Mallocs. The number of live
408+
// objects in this size class is Mallocs - Frees.
401409
Mallocs uint64
402-
Frees uint64
410+
411+
// Frees is the cumulative count of heap objects freed
412+
// in this size class.
413+
Frees uint64
403414
}
404415
}
405416

0 commit comments

Comments
 (0)