Skip to content

Commit

Permalink
Fix issue jetty#5499
Browse files Browse the repository at this point in the history
this PR let the ByteAccumulator recyclable. after invoke ByteAccumulator.transferTo method
we can invoke ByteAccumulator.recycle method to reuse byte[] via ByteAccumulator.newByteArray method

Signed-off-by: Baoyi Chen <chen.bao.yi@qq.com>
  • Loading branch information
leonchen83 committed Oct 30, 2020
1 parent 64a4738 commit 93db832
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -62,7 +62,7 @@ public void copyChunk(ByteBuffer buffer)
{
// release 0 length buffer directly
if (bufferPool != null)
bufferPool.release((ByteBuffer)buffer.clear());
bufferPool.release(buffer);
}
}

Expand Down Expand Up @@ -122,7 +122,7 @@ void recycle()
}
for (ByteBuffer chunk : chunks)
{
bufferPool.release((ByteBuffer)chunk.clear());
bufferPool.release(chunk);
}

chunks.clear();
Expand Down

0 comments on commit 93db832

Please sign in to comment.