forked from TrueCloudLab/restic
22 lines
277 B
Go
22 lines
277 B
Go
|
package server
|
||
|
|
||
|
import (
|
||
|
"sync"
|
||
|
|
||
|
"github.com/restic/restic/chunker"
|
||
|
)
|
||
|
|
||
|
var bufPool = sync.Pool{
|
||
|
New: func() interface{} {
|
||
|
return make([]byte, chunker.MinSize)
|
||
|
},
|
||
|
}
|
||
|
|
||
|
func getBuf() []byte {
|
||
|
return bufPool.Get().([]byte)
|
||
|
}
|
||
|
|
||
|
func freeBuf(data []byte) {
|
||
|
bufPool.Put(data)
|
||
|
}
|