MCPcopy
hub / github.com/rs/zerolog / putArray

Function putArray

array.go:27–44  ·  view source on GitHub ↗
(a *Array)

Source from the content-addressed store, hash-verified

25}
26
27func 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

Callers 1

writeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…