2015-05-09 21:52:03 +00:00
|
|
|
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{} {
|
2018-04-08 19:57:52 +00:00
|
|
|
return make([]byte, chunker.MaxSize/3)
|
2015-04-26 12:46:15 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func getBuf() []byte {
|
|
|
|
return bufPool.Get().([]byte)
|
|
|
|
}
|
|
|
|
|
|
|
|
func freeBuf(data []byte) {
|
|
|
|
bufPool.Put(data)
|
|
|
|
}
|