Skip to content

Commit 7a03219

Browse files
committed
Avoid allocation
1 parent 99e633d commit 7a03219

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

evio_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func loopAccept(s *server, l *loop, fd int) error {
291291
return err
292292
}
293293
c := &conn{fd: nfd, sa: sa, lnidx: i, loop: l}
294-
c.out = make([]byte, 0, 4096)
294+
c.out = nil
295295
l.fdconns[c.fd] = c
296296
l.poll.AddReadWrite(c.fd)
297297
atomic.AddInt32(&l.count, 1)
@@ -381,7 +381,7 @@ func loopWrite(s *server, l *loop, c *conn) error {
381381
// release the connection output page if it goes over page size,
382382
// otherwise keep reusing existing page.
383383
if cap(c.out) > 4096 {
384-
c.out = make([]byte, 0, 4096)
384+
c.out = nil
385385
} else {
386386
c.out = c.out[:0]
387387
}

0 commit comments

Comments
 (0)