WriteDirect is used to insert an additional slice of data on the current write stream. For example, if you plan to execute: var bufA, _ = Malloc(nA) WriteBinary(b) var bufB, _ = Malloc(nB) It can be replaced by: var buf, _ = Malloc(nA+nB) WriteDirect(b, nB) where buf[:nA] = bufA, buf[nA:nA+nB] =
(p []byte, remainCap int)
| 170 | // |
| 171 | // where buf[:nA] = bufA, buf[nA:nA+nB] = bufB. |
| 172 | WriteDirect(p []byte, remainCap int) error |
| 173 | |
| 174 | // MallocAck will keep the first n malloc bytes and discard the rest. |
| 175 | // The following behavior: |
no outgoing calls