[go-nuts] A question about the description of sync.Pool.Get

2017-10-26 Thread Tamás Gulácsi
It emphasize "Callers should not assume any relation between values passed to Put and the values returned by Get." It is to allow the implementation to do as it wish - it is not a free list, but a GC-friendly hack that helps amortize allocation cost for unknown number of goroutines. -- You re

[go-nuts] A question about the description of sync.Pool.Get

2017-10-26 Thread jingguo yao
Can anyone explain the meaning of " Get may choose to ignore the pool and treat it as empty." in https://golang.org/pkg/sync/#Pool.Get? > Get selects an arbitrary item from the Pool, removes it from the Pool, and returns it to the caller. Get may choose to ignore the pool and treat it as empty. Ca