MCPcopy Create free account
hub / github.com/cloudwego/netpoll / Malloc

Method Malloc

connection_impl.go:244–249  ·  view source on GitHub ↗

------------------------------------------ implement zero-copy writer ------------------------------------------ Malloc implements Connection.

(n int)

Source from the content-addressed store, hash-verified

242
243// Malloc implements Connection.
244func (c *connection) Malloc(n int) (buf []byte, err error) {
245 if !c.IsActive() {
246 return nil, Exception(ErrConnClosed, "when malloc")
247 }
248 return c.outputBuffer.Malloc(n)
249}
250
251// MallocLen implements Connection.
252func (c *connection) MallocLen() (length int) {

Callers 1

TestWriterAfterCloseFunction · 0.95

Calls 3

IsActiveMethod · 0.95
ExceptionFunction · 0.85
MallocMethod · 0.65

Tested by 1

TestWriterAfterCloseFunction · 0.76