Unverified Commit 3d7d91fd authored by 望哥's avatar 望哥 Committed by GitHub

not add non-equal cap bytes back to pool (#17)

parent 573f790d
...@@ -72,8 +72,9 @@ func (bp *BytesPool) AcquireBytes(size int) []byte { ...@@ -72,8 +72,9 @@ func (bp *BytesPool) AcquireBytes(size int) []byte {
// ReleaseBytes ... // ReleaseBytes ...
func (bp *BytesPool) ReleaseBytes(buf []byte) { func (bp *BytesPool) ReleaseBytes(buf []byte) {
idx := bp.findIndex(cap(buf)) bufCap := cap(buf)
if idx >= bp.length { idx := bp.findIndex(bufCap)
if idx >= bp.length || bp.sizes[idx] != bufCap {
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment