pepijnve opened a new issue, #763:
URL: https://github.com/apache/arrow-java/issues/763

   ### Describe the usage question you have. Please include as many useful 
details as possible.
   
   
   The various import methods in the Data class are documented to transfer 
ownership of the Arrow data from the input object to internal values as per the 
C FFI. If I'm reading 
https://arrow.apache.org/docs/format/CDataInterface.html#moving-an-array 
correctly, implementations are supposed to hollow out the input object in that 
case by nulling the release field. In practice a class like ArrayImporter does 
this
   
   ```
   void importArray(ArrowArray src) {
     ...
     // Move imported array
     ArrowArray ownedArray = ArrowArray.allocateNew(allocator);
     ownedArray.save(snapshot);
     src.markReleased();
     src.close();
     ...
   }
   ```
   
   So not only is the array marked as released, it is also closed so the 
ArrowArray instance is no longer usable. This may or may not happen when you 
call `Data#importIntoVector` for instance, since that might abort early when 
given a null `Allocator` which makes the post conditions of 
`Data#importIntoVector` a bit unclear. You kind of expect the ArrowArray to 
have been closed, but you still need to call close yourself as well or risk 
having a memory leak.
   
   What's the rationale behind the choice to also call `close` on objects 
passed to Data rather than expecting people to use 
try-with-resources/try-finally themselves?


-- 
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: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to