1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-26 17:57:50 +00:00
restic/server/pool.go

22 lines
277 B
Go
Raw Normal View History

2015-04-26 12:46:15 +00:00
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)
}