Skip to content

Commit

Permalink
Document the fact that we zero segments in .Release()
Browse files Browse the repository at this point in the history
  • Loading branch information
zenhack committed Nov 27, 2022
1 parent 67f52e6 commit 0f157e3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0f157e3

Please sign in to comment.