GetBytesBuffer returns a *bytes.Buffer that is managed by a sync.Pool. Returns a buffer that is reset and ready for use. After use, the *bytes.Buffer should be put back into the sync.Pool by calling PutBytesBuffer.
()
| 40 | // After use, the *bytes.Buffer should be put back into the sync.Pool |
| 41 | // by calling PutBytesBuffer. |
| 42 | func GetBytesBuffer() *bytes.Buffer { |
| 43 | buf := bytesBuffer.Get().(*bytes.Buffer) |
| 44 | buf.Reset() |
| 45 | return buf |
| 46 | } |
| 47 | |
| 48 | // PutBytesBuffer puts buf back into its sync.Pool. |
| 49 | func PutBytesBuffer(buf *bytes.Buffer) { |
searching dependent graphs…