remove references after content is written

pull/1269/head v3.37.5
Darien Raymond 2018-08-31 22:56:17 +02:00
parent aefbc4c5de
commit 834dc4ab7c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 8 additions and 1 deletions

View File

@ -33,7 +33,14 @@ func (w *BufferToBytesWriter) WriteMultiBuffer(mb MultiBuffer) error {
for _, b := range mb {
bs = append(bs, b.Bytes())
}
w.cache = bs[:0]
w.cache = bs
defer func() {
for idx := range w.cache {
w.cache[idx] = nil
}
w.cache = w.cache[:0]
}()
nb := net.Buffers(bs)