Put returns a buffer to the pool for reuse. The buffer's capacity is preserved, allowing it to be reused for similarly-sized operations without reallocation. Buffers with zero capacity are discarded. Thread Safety: Safe for concurrent calls. It's safe to call Put multiple times with the same buff
(buf []byte)
| 90 | // Parameters: |
| 91 | // - buf: The byte slice to return to the pool |
| 92 | func (p *BufferPool) Put(buf []byte) { |
| 93 | if cap(buf) > 0 { |
| 94 | p.pool.Put(&buf) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | // Grow ensures the buffer has enough capacity for n additional bytes. |
| 99 | // |
no outgoing calls