[volume] Reduce the number of buffers for uploading one chunk (#5458)

This commit is contained in:
Konstantin Lebedev
2024-04-11 16:47:21 +05:00
committed by GitHub
parent 6dae685f9c
commit 5189a09de0
5 changed files with 50 additions and 17 deletions

View File

@@ -0,0 +1,20 @@
package buffer_pool
import (
"bytes"
"sync"
)
var syncPool = sync.Pool{
New: func() interface{} {
return new(bytes.Buffer)
},
}
func SyncPoolGetBuffer() *bytes.Buffer {
return syncPool.Get().(*bytes.Buffer)
}
func SyncPoolPutBuffer(buffer *bytes.Buffer) {
syncPool.Put(buffer)
}