Skip to content

Commit 0f157e3

Browse files
committed
Document the fact that we zero segments in .Release()
1 parent 67f52e6 commit 0f157e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

message.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,12 @@ func MultiSegment(b [][]byte) *MultiSegmentArena {
489489
// Return this arena to an internal sync.Pool of arenas that can be
490490
// re-used. Any time MultiSegment(nil) is called, arenas from this
491491
// pool will be used if available, which can help reduce memory
492-
// allocations. Calling Release however is optional; if not done
493-
// the garbage collector will release the memory per usual.
492+
// allocations.
493+
//
494+
// All segments will be zeroed before re-use.
495+
//
496+
// Calling Release is optional; if not done the garbage collector
497+
// will release the memory per usual.
494498
func (msa *MultiSegmentArena) Release() {
495499
for i, v := range *msa {
496500
// Clear the memory, so there's no junk in here for the next use:

0 commit comments

Comments
 (0)