mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-23 03:53:34 +08:00
[volume] Reduce the number of buffers for uploading one chunk (#5458)
This commit is contained in:

committed by
GitHub

parent
6dae685f9c
commit
5189a09de0
20
weed/util/buffer_pool/sync_pool.go
Normal file
20
weed/util/buffer_pool/sync_pool.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user