makeSlice allocates a slice of size n -- it will attempt to use a pool'ed instance whenever possible.
(n int)
| 91 | // makeSlice allocates a slice of size n -- it will attempt to use a pool'ed |
| 92 | // instance whenever possible. |
| 93 | func makeSlice(n int) []byte { |
| 94 | if n <= 64 { |
| 95 | return pool64.Get().([]byte)[0:n] |
| 96 | } |
| 97 | |
| 98 | pn := poolNum(n) |
| 99 | |
| 100 | if pn != -1 { |
| 101 | return pools[pn].Get().([]byte)[0:n] |
| 102 | } else { |
| 103 | return make([]byte, n) |
| 104 | } |
| 105 | } |
no test coverage detected
searching dependent graphs…