From e11181807f1ce7b1a939cbea6a283be368c811fb Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 17 Dec 2015 18:50:05 +0900 Subject: [PATCH] Memory leak squashing --- goldsmith.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/goldsmith.go b/goldsmith.go index f1611af..50ebb8d 100644 --- a/goldsmith.go +++ b/goldsmith.go @@ -23,6 +23,7 @@ package goldsmith import ( + "bytes" "os" "path" "path/filepath" @@ -126,7 +127,7 @@ func (gs *goldsmith) cleanupFiles() { func (gs *goldsmith) exportFile(file *File) { defer func() { - file.Buff.Reset() + file.Buff = *bytes.NewBuffer(nil) atomic.AddInt64(&gs.busy, -1) }() @@ -221,6 +222,7 @@ func (gs *goldsmith) chain(s *stage, p Plugin) { if proc.Process(s, f) { dispatch(f) } else { + f.Buff = *bytes.NewBuffer(nil) atomic.AddInt64(&gs.busy, -1) } }(file)