From 5ff837e2e7b2e3a36c6c2290800752e42af015a0 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Wed, 1 Feb 2017 18:14:37 -0800 Subject: [PATCH] content: use buffer pool in hash copy Signed-off-by: Stephen J Day --- content/content.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/content/content.go b/content/content.go index e1d5e61..03bc1ff 100644 --- a/content/content.go +++ b/content/content.go @@ -284,7 +284,10 @@ func (cs *Store) Resume(ref string) (*Writer, error) { } defer fp.Close() - offset, err := io.Copy(digester.Hash(), fp) + p := bufPool.Get().([]byte) + defer bufPool.Put(p) + + offset, err := io.CopyBuffer(digester.Hash(), fp, p) if err != nil { return nil, err }