diff options
| author | chrislu <chris.lu@gmail.com> | 2022-02-26 02:59:19 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-02-26 02:59:19 -0800 |
| commit | 2ab0ad24a3451410f7ff0fd6cbd9ae5bb5c33634 (patch) | |
| tree | f1b3a358258b1fd01a3138b832e51a753a748ee8 | |
| parent | 28b395bef4887b55392af08f88aa345ea67b3d23 (diff) | |
| download | seaweedfs-2ab0ad24a3451410f7ff0fd6cbd9ae5bb5c33634.tar.xz seaweedfs-2ab0ad24a3451410f7ff0fd6cbd9ae5bb5c33634.zip | |
use memory pool
| -rw-r--r-- | weed/util/http_util.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/util/http_util.go b/weed/util/http_util.go index 8b66c6dc1..2f42d3768 100644 --- a/weed/util/http_util.go +++ b/weed/util/http_util.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/chrislusf/seaweedfs/weed/util/mem" "io" "net/http" "net/url" @@ -326,7 +327,8 @@ func ReadUrlAsStream(fileUrl string, cipherKey []byte, isContentGzipped bool, is var ( m int ) - buf := make([]byte, 64*1024) + buf := mem.Allocate(64 * 1024) + defer mem.Free(buf) for { m, err = reader.Read(buf) |
