Skip to content

Commit

Permalink
Resize byte buffer instead of allocating a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Aug 28, 2022
1 parent 0763888 commit 930993f
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@ public boolean ensureBufferCapacity(int bytes) {

LOGGER.debug("Needed to grow BufferBuilder buffer: Old size {} bytes, new size {} bytes.", this.buffer.capacity(), newSize);

this.buffer.position(0);

ByteBuffer byteBuffer = GlAllocationUtils.allocateByteBuffer(newSize);
byteBuffer.put(this.buffer);
ByteBuffer byteBuffer = GlAllocationUtils.resizeByteBuffer(this.buffer, newSize);
byteBuffer.rewind();

this.buffer = byteBuffer;

return true;
Expand Down

0 comments on commit 930993f

Please sign in to comment.