From 5a0986dca093e38e9a74213683801b39736f4362 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 29 Apr 2020 02:41:01 -0700 Subject: [PATCH] reset on getting the buffer --- weed/util/log_buffer/log_buffer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weed/util/log_buffer/log_buffer.go b/weed/util/log_buffer/log_buffer.go index e447aacb7..69d663484 100644 --- a/weed/util/log_buffer/log_buffer.go +++ b/weed/util/log_buffer/log_buffer.go @@ -226,7 +226,6 @@ func (m *LogBuffer) ReadFromBuffer(lastReadTime time.Time) (bufferCopy *bytes.Bu } func (m *LogBuffer) ReleaseMeory(b *bytes.Buffer) { - b.Reset() bufferPool.Put(b) } @@ -238,6 +237,7 @@ var bufferPool = sync.Pool{ func copiedBytes(buf []byte) (copied *bytes.Buffer) { copied = bufferPool.Get().(*bytes.Buffer) + copied.Reset() copied.Write(buf) return }