(a *Array)
| 25 | } |
| 26 | |
| 27 | func putArray(a *Array) { |
| 28 | // prevent any subsequent use of the Array contextual state and truncate the buffer |
| 29 | a.stack = false |
| 30 | a.ctx = nil |
| 31 | a.ch = nil |
| 32 | a.buf = a.buf[:0] |
| 33 | |
| 34 | // Proper usage of a sync.Pool requires each entry to have approximately |
| 35 | // the same memory cost. To obtain this property when the stored type |
| 36 | // contains a variably-sized buffer, we add a hard limit on the maximum buffer |
| 37 | // to place back in the pool. |
| 38 | // |
| 39 | // See https://golang.org/issue/23199 |
| 40 | const maxSize = 1 << 16 // 64KiB |
| 41 | if cap(a.buf) <= maxSize { |
| 42 | arrayPool.Put(a) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // Arr creates an array to be added to an Event or Context. |
| 47 | // WARNING: This function is deprecated because it does not preserve |
no outgoing calls
no test coverage detected
searching dependent graphs…