diff --git a/connection_reactor.go b/connection_reactor.go index cd5d717c..619c7a15 100644 --- a/connection_reactor.go +++ b/connection_reactor.go @@ -74,6 +74,7 @@ func (c *connection) closeBuffer() { } if c.outputBuffer.Len() == 0 || onConnect != nil || onRequest != nil { c.outputBuffer.Close() + c.outputBarrier.reset() barrierPool.Put(c.outputBarrier) } } diff --git a/sys_exec.go b/sys_exec.go index 1c8e40e4..965aa968 100644 --- a/sys_exec.go +++ b/sys_exec.go @@ -62,6 +62,16 @@ type barrier struct { ivs []syscall.Iovec } +func (b *barrier) reset() { + for i := range b.bs { + b.bs[i] = nil + } + for i := range b.ivs { + b.ivs[i].Base = nil + b.ivs[i].Len = 0 + } +} + // writev wraps the writev system call. func writev(fd int, bs [][]byte, ivs []syscall.Iovec) (n int, err error) { iovLen := iovecs(bs, ivs)