mirror of
https://github.com/datarhei/core.git
synced 2025-12-24 13:07:56 +08:00
User buffer pool where appropriate
This commit is contained in:
@@ -31,3 +31,17 @@ func (p *BufferPool) Get() *bytes.Buffer {
|
||||
func (p *BufferPool) Put(buf *bytes.Buffer) {
|
||||
p.pool.Put(buf)
|
||||
}
|
||||
|
||||
var DefaultBufferPool *BufferPool
|
||||
|
||||
func init() {
|
||||
DefaultBufferPool = NewBufferPool()
|
||||
}
|
||||
|
||||
func Get() *bytes.Buffer {
|
||||
return DefaultBufferPool.Get()
|
||||
}
|
||||
|
||||
func Put(buf *bytes.Buffer) {
|
||||
DefaultBufferPool.Put(buf)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user