PutParser returns a Parser instance to the pool after resetting it. This MUST be called after parsing is complete to enable reuse and prevent memory leaks. The parser is automatically reset before being returned to the pool, clearing all internal state (tokens, position, depth, context, position ma
(p *Parser)
| 103 | // |
| 104 | // Thread Safety: Safe for concurrent calls - operates on independent parser instances. |
| 105 | func PutParser(p *Parser) { |
| 106 | if p != nil { |
| 107 | p.Reset() |
| 108 | parserPool.Put(p) |
| 109 | metrics.RecordNamedPoolPut("parser") |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | // Reset clears the parser state for reuse from the pool. |
| 114 | func (p *Parser) Reset() { |