From a37afc7d96d5deaf6aa92474cdda70a7dc0bcd94 Mon Sep 17 00:00:00 2001 From: qydysky Date: Wed, 11 May 2022 10:06:22 +0800 Subject: [PATCH] fix large allocs --- io/io.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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] -- 2.39.2