文章来源于: https://gobea.cn/blog/detail/VrL2jbol.html
sync.Pool作用
对象重用机制,为了减少GC,sync.Pool
是可伸缩的,并发安全的
两个结构体
type Pool struct {
local unsafe.Pointer // local fixed-size per-P pool, actual type is [P]poolLocal
localSize uintptr // size of the local array
// New optionally specifies a function to generate
// a value when Get would otherwise return nil.
// It may not be changed concurrently with calls to Get.<