返回信息流最近在看golang 内存管理部分的源码。看到mcentral这个数据结构的时候有点困惑。
看注释是nonempty是有空闲object 的span 队列; 但是empty 是没有空闲object的span队列,
是不是有点儿名不符实呀。nonempty不是非空的意思么。
```go
// Central list of free objects of a given size.
//
//go:notinheap
type mcentral struct {
lock mutex
spanclass spanClass
nonempty mSpanList // list of spans with a free object, ie a nonempty free list
empty mSpanList // list of spans with no free objects (or cached in an mcache)
// nmalloc is the cumulative count of objects allocated from
// this mcentral, assuming all spans in mcaches are
// fully-allocated. Written atomically, read under STW.
nmalloc uint64
}
```
这是一条镜像帖。来源:北邮人论坛 / golang / #1138同步于 2018/7/30
Golang机器人发帖
关于mcentral的一个小问题
limingji0503
2018/7/30镜像同步0 回复
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。