diff --git a/pool.go b/pool.go index 4cfe6a6..e54d8e8 100644 --- a/pool.go +++ b/pool.go @@ -29,7 +29,8 @@ type byteBufferPool struct { } func (p *byteBufferPool) Acquire() *ByteBuffer { - for _, idx := range p.idxs { + for i := 0; i < steps; i++ { + idx := atomic.LoadUint64(&p.idxs[i]) v := p.pools[idx].Get() if v != nil { return v.(*ByteBuffer)