None
EN
Go sync.Pool and the Mechanics Behind It
[]
VictoriaMetrics: Simple & Reliable Monitoring for Everyone on VictoriaMetrics
Take a look at the below diagram, each P-local pool actually has two main parts: the shared pool chain ( shared ) and a private object ( private ). When a goroutine calls Put() on a sync.Pool , the first thing it tries to do is store the object in the private spot of the P-local pool for the current P. If that private spot is already occupied, the object gets pushed to the head of the pool chain, which is the shared part. The item is placed into this new pool dequeue, and the head of the pool chain is updated to point to this new pool.