MCPcopy Create free account
hub / github.com/cortexproject/cortex / init

Method init

pkg/cortexpb/slicesPool.go:22–33  ·  view source on GitHub ↗
(pools int)

Source from the content-addressed store, hash-verified

20}
21
22func (sp *byteSlicePools) init(pools int) {
23 sp.pools = make([]sync.Pool, pools)
24 for i := range pools {
25 size := int(math.Pow(2, float64(i+minPoolSizePower)))
26 sp.pools[i] = sync.Pool{
27 New: func() any {
28 buf := make([]byte, 0, size)
29 return &buf
30 },
31 }
32 }
33}
34
35func (sp *byteSlicePools) getSlice(size int) *[]byte {
36 index := int(math.Ceil(math.Log2(float64(size)))) - minPoolSizePower

Callers 1

newSlicePoolFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected