blob: d8a52061818a7cecc325d2e26b0c754d4db9d15f (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package bufpool
// Release returns the buffer to the global pool if it originated from the
// pool and its capacity is no larger than maxPooledBuffer. After release, the
// Buffer becomes invalid and should not be used further.
//
// Releasing a non-pooled buffer has no effect beyond clearing its internal
// storage.
func (buf *Buffer) Release() {
if buf.buf == nil {
return
}
buf.returnToPool()
buf.buf = nil
buf.pool = unpooled
}
|