sezruby opened a new pull request, #1492:
URL: https://github.com/apache/arrow-java/pull/1492

   ## What's Changed
   
   `ArrowArrayStreamReader.loadNextBatch` now releases the batch when the 
import fails before moving it out of the array: allocating the schema struct on 
the first batch, or allocating the struct the batch moves into. Before this 
change, the struct was closed without calling its release callback, and the 
producer's batch leaked. This is the stream counterpart of #1239, which covered 
failures while importing the buffers.
   
   `ImportOutOfMemoryTest.streamImportOomDoesNotLeakExportedBatch` exports a 
one-batch stream and imports it into a consumer allocator, sweeping the 
consumer's limit over every allocation of the import. After each failure it 
checks that the exporting allocator drains to zero. It runs twice: once reading 
the schema lazily, and once reading it before the first batch.
   - Both passes fail on main: with a limit of 192 the exporting allocator 
keeps 16688 bytes.
   - Both pass with the fix.
   - All 190 tests of the c module pass.
   
   The change and the test were written with AI assistance (Claude Code). I 
reproduced the leak and verified the fix locally.
   
   Closes #1491.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to