acvictor opened a new pull request, #11754: URL: https://github.com/apache/gluten/pull/11754
## What changes are proposed in this pull request? This PR closes `ColumnarBatch` for skipped or sliced batches in `ColumnarCollectLimitExec`. `ColumnarCollectLimitExec.fetchNextBatch()` leaks memory in two cases: 1. Skipped batches: When a batch falls entirely within the offset range, it is consumed from the input iterator but never closed. 2. Sliced batches: When a batch is partially within the offset/limit window, VeloxColumnarBatches.slice() creates a new native batch, but the original source batch is never closed. In both cases the `ColumnarBatch` object is small but it holds a JNI handle to a native Velox vector. Since ColumnarBatch has no finalizer, the native memory is only freed by an explicit close() call. Queries with large offsets (e.g., OFFSET 10000) would leak one batch per skipped chunk. ## How was this patch tested? Existing UTs ## Was this patch authored or co-authored using generative AI tooling? No -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
