Get retrieves a buffer from the pool. The returned buffer has zero length but may have capacity >= 128 bytes from previous use. This allows efficient appending without reallocation for typical SQL tokens. Thread Safety: Safe for concurrent calls. The buffer must be returned to the pool via Put()
()
| 72 | // |
| 73 | // Returns a byte slice ready for use (length 0, capacity >= 128). |
| 74 | func (p *BufferPool) Get() []byte { |
| 75 | buf := p.pool.Get().(*[]byte) |
| 76 | *buf = (*buf)[:0] // Reset length but keep capacity |
| 77 | return *buf |
| 78 | } |
| 79 | |
| 80 | // Put returns a buffer to the pool for reuse. |
| 81 | // |
no outgoing calls