Skip to content

Commit

Permalink
apacheGH-41648: [Java] Memory Leak about splitAndTransfer (apache#41898)
Browse files Browse the repository at this point in the history
### Rationale for this change

An inconsistency in the validity buffer split and transfer functionality in the `BaseFixedWidthVector`. 

### What changes are included in this PR?

- [X] Change to handle the validity buffer transfer
- [X] User provided test criterion which reproduced the error
- [X] Upgrading to JUnit 5

### Are these changes tested?

Mainly by existing test cases and added new one. 

### Are there any user-facing changes?

No
* GitHub Issue: apache#41648

Authored-by: Vibhatha Abeykoon <[email protected]>
Signed-off-by: David Li <[email protected]>
  • Loading branch information
vibhatha authored Jun 3, 2024
1 parent 02585cd commit 54bece3
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,8 @@ private void splitAndTransferValidityBuffer(int startIndex, int length,
if (target.validityBuffer != null) {
target.validityBuffer.getReferenceManager().release();
}
target.validityBuffer = validityBuffer.slice(firstByteSource, byteSizeTarget);
target.validityBuffer.getReferenceManager().retain(1);
ArrowBuf slicedValidityBuffer = validityBuffer.slice(firstByteSource, byteSizeTarget);
target.validityBuffer = transferBuffer(slicedValidityBuffer, target.allocator);
target.refreshValueCapacity();
} else {
/* Copy data
Expand Down
Loading

0 comments on commit 54bece3

Please sign in to comment.