Skip to content

Commit

Permalink
fix: Don't drop objects on empty buffers (pola-rs#18469)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Aug 30, 2024
1 parent 910fc03 commit ae3c647
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/polars-core/src/chunked_array/object/extension/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ pub(crate) unsafe fn drop_object_array(values: &dyn Array) {
.downcast_ref::<FixedSizeBinaryArray>()
.unwrap();

// if the buf is not shared with anyone but us
// we can deallocate
// If the buf is not shared with anyone but us we can deallocate.
let buf = arr.values();
if buf.shared_count_strong() == 1 {
if buf.shared_count_strong() == 1 && !buf.is_empty() {
PolarsExtension::new(arr.clone());
};
}

0 comments on commit ae3c647

Please sign in to comment.