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

This commit is contained in:
Konstantin Lebedev authored and GitHub committed 2024-04-11 04:47:21 -07:00
1 parent 6dae685f9c
commit 5189a09de0
5 files changed
+50 -17

No files matched your search

+20
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)
}