Static rerun_bindings::python_bridge::GARBAGE_QUEUE
source · static GARBAGE_QUEUE: Lazy<(Sender<RecordBatch>, Receiver<RecordBatch>)>
Expand description
§Release Callbacks
When Arrow data gets logged from Python to Rust across FFI, it carries with it a release
callback (see Arrow spec) that will be run when the data gets dropped.
This is an issue in this case because running that callback will likely try and grab the GIL, which is something that should only happen at very specific times, else we end up with deadlocks, segfaults, aborts…
§The garbage queue
When a re_log_types::LogMsg
that was logged from Python gets dropped on the Rust side, it will end up
in this queue.
The mere fact that the data still exists in this queue prevents the underlying Arrow refcount
to go below one, which in turn prevents the associated FFI release
callback to run, which
avoids the issue mentioned above.
When the time is right, call flush_garbage_queue
to flush the queue and deallocate all the
accumulated data for real.