lidavidm commented on code in PR #41967: URL: https://github.com/apache/arrow/pull/41967#discussion_r1635892470
########## java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java: ########## @@ -227,10 +227,39 @@ public List<ArrowBuf> visit(ArrowType.Utf8 type) { } } + private List<ArrowBuf> visitVariableWidthView(ArrowType type) { + final int viewBufferIndex = 1; + final int variadicSizeBufferIndex = this.buffers.length - 1; + final long numOfVariadicBuffers = this.buffers.length - 3; + final long variadicSizeBufferCapacity = numOfVariadicBuffers * Long.BYTES; + List<ArrowBuf> buffers = new ArrayList<>(); + + try (ArrowBuf variadicSizeBuffer = + importBuffer(type, variadicSizeBufferIndex, variadicSizeBufferCapacity)) { + ArrowBuf maybeValidityBuffer = maybeImportBitmap(type); + try (ArrowBuf view = + importFixedBytes(type, viewBufferIndex, BaseVariableWidthViewVector.ELEMENT_SIZE)) { + view.getReferenceManager().retain(); + buffers.add(maybeValidityBuffer); + buffers.add(view); + } Review Comment: Unless we have to retain it, wouldn't this be a memory leak? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org