You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "timsaucer (via GitHub)" <gi...@apache.org> on 2025/08/14 13:30:37 UTC
[PR] FFI_RecordBatchStream was causing a memory leak [datafusion]
timsaucer opened a new pull request, #17190:
URL: https://github.com/apache/datafusion/pull/17190
## Which issue does this PR close?
None
## Rationale for this change
When using the foreign function interface, a `Box<RecordBatchStreamPrivateData>` is created but it is never properly freed. This leads to a growth in memory over time as these are used.
## What changes are included in this PR?
Adds a `release` function to FFI_RecordBatchStream and implements `Drop`.
## Are these changes tested?
Tested against `datafusion-python` where it is easy to track memory growth and to implement FFI based table providers.
## Are there any user-facing changes?
None
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] FFI_RecordBatchStream was causing a memory leak [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #17190:
URL: https://github.com/apache/datafusion/pull/17190
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] FFI_RecordBatchStream was causing a memory leak [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #17190:
URL: https://github.com/apache/datafusion/pull/17190#discussion_r2282322284
##########
datafusion/ffi/src/record_batch_stream.rs:
##########
@@ -96,6 +100,12 @@ unsafe extern "C" fn schema_fn_wrapper(stream: &FFI_RecordBatchStream) -> Wrappe
(*stream).schema().into()
}
+unsafe extern "C" fn release_fn_wrapper(provider: &mut FFI_RecordBatchStream) {
+ let private_data =
Review Comment:
I double checked that the `private_data` is actually a `RecordBatchStreamPrivateData` that is created with the constructor
https://github.com/apache/datafusion/blob/327f8bceae270cceffeb843d271f053b8570ad5e/datafusion/ffi/src/record_batch_stream.rs#L80-L84
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] FFI_RecordBatchStream was causing a memory leak [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #17190:
URL: https://github.com/apache/datafusion/pull/17190#issuecomment-3196690924
I also merged up from main
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org