1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-27 02:08:37 +00:00
restic/internal/repository/pool.go

22 lines
274 B
Go
Raw Normal View History

package repository
2015-04-26 12:46:15 +00:00
import (
"sync"
2015-07-07 22:55:58 +00:00
"github.com/restic/chunker"
2015-04-26 12:46:15 +00:00
)
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)
}