Skip to content

Commit

Permalink
fix: addressing reviews 11: minor changes to allocation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed May 14, 2024
1 parent 694420e commit 0089c14
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,15 @@ public boolean allocateNewSafe() {
}

private void allocateBuffers() {
offsetBuffer = allocateBuffers(offsetAllocationSizeInBytes, true);
sizeBuffer = allocateBuffers(sizeAllocationSizeInBytes, false);
offsetBuffer = allocateBuffers(offsetAllocationSizeInBytes);
sizeBuffer = allocateBuffers(sizeAllocationSizeInBytes);
}

private ArrowBuf allocateBuffers(final long size, boolean isOffSet) {
private ArrowBuf allocateBuffers(final long size) {
final int curSize = (int) size;
ArrowBuf buffer = allocator.buffer(curSize);
buffer.readerIndex(0);
buffer.setZero(0, buffer.capacity());
if (isOffSet) {
offsetAllocationSizeInBytes = curSize;
} else {
sizeAllocationSizeInBytes = curSize;
}
return buffer;
}

Expand Down

0 comments on commit 0089c14

Please sign in to comment.