GetByteSlice returns a *[]byte that is managed by a sync.Pool. The initial slice length will be 16384 (16kb). After use, the *[]byte should be put back into the sync.Pool by calling PutByteSlice.
()
| 25 | // After use, the *[]byte should be put back into the sync.Pool |
| 26 | // by calling PutByteSlice. |
| 27 | func GetByteSlice() *[]byte { |
| 28 | buf := byteSlice.Get().(*[]byte) |
| 29 | return buf |
| 30 | } |
| 31 | |
| 32 | // PutByteSlice puts buf back into its sync.Pool. |
| 33 | func PutByteSlice(buf *[]byte) { |
searching dependent graphs…