From 0f157e3269f61721c52f7c3591a99973e1ee9153 Mon Sep 17 00:00:00 2001 From: Ian Denhardt Date: Sun, 27 Nov 2022 17:59:03 -0500 Subject: [PATCH] Document the fact that we zero segments in .Release() --- message.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/message.go b/message.go index d031fb7c..eab2173c 100644 --- a/message.go +++ b/message.go @@ -489,8 +489,12 @@ func MultiSegment(b [][]byte) *MultiSegmentArena { // Return this arena to an internal sync.Pool of arenas that can be // re-used. Any time MultiSegment(nil) is called, arenas from this // pool will be used if available, which can help reduce memory -// allocations. Calling Release however is optional; if not done -// the garbage collector will release the memory per usual. +// allocations. +// +// All segments will be zeroed before re-use. +// +// Calling Release is optional; if not done the garbage collector +// will release the memory per usual. func (msa *MultiSegmentArena) Release() { for i, v := range *msa { // Clear the memory, so there's no junk in here for the next use: