Skip to content

Commit

Permalink
chore: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
panjf2000 committed Sep 21, 2024
1 parent d416b0c commit 20b5a50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/pool/byteslice/byteslice.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ func (p *Pool) Put(buf []byte) {
if size != 1<<idx { // this byte slice is not from Pool.Get(), put it into the previous interval of idx
idx--
}
// array pointer
// Store the pointer to the underlying array instead of the pointer to the slice itself,
// which circumvents the escape of buf from the stack to the heap.
p.pools[idx].Put(unsafe.SliceData(buf))
}

Expand Down

0 comments on commit 20b5a50

Please sign in to comment.