From: qydysky Date: Wed, 11 May 2022 02:06:22 +0000 (+0800) Subject: fix large allocs X-Git-Tag: v0.9.3 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=a37afc7d96d5deaf6aa92474cdda70a7dc0bcd94;p=part%2F.git fix large allocs --- diff --git a/io/io.go b/io/io.go index 3499cd3..5e89be6 100644 --- a/io/io.go +++ b/io/io.go @@ -10,8 +10,8 @@ func RW2Chan(r io.ReadCloser, w io.WriteCloser) (rc, wc chan []byte) { if r != nil { rc = make(chan []byte, 10) go func(rc chan []byte, r io.ReadCloser) { + buf := make([]byte, 1<<16) for { - buf := make([]byte, 1<<16) n, e := r.Read(buf) if n != 0 { rc <- buf[:n]