Describe the bug, including details regarding any error messages, version, and platform.
When importing a C Data array into a BufferAllocator that hits its limit part-way through a multi-buffer array, the producer's native memory leaks permanently.
The bug is in ReferenceCountedArrowArray.unsafeAssociateAllocation: it increments the reference count before calling wrapForeignAllocation. If wrapForeignAllocation throws (allocator over limit), nothing decrements that count, so the C Data release callback never fires.
Fix: move retain() to after wrapForeignAllocation succeeds.
Describe the bug, including details regarding any error messages, version, and platform.
When importing a C Data array into a BufferAllocator that hits its limit part-way through a multi-buffer array, the producer's native memory leaks permanently.
The bug is in ReferenceCountedArrowArray.unsafeAssociateAllocation: it increments the reference count before calling wrapForeignAllocation. If wrapForeignAllocation throws (allocator over limit), nothing decrements that count, so the C Data release callback never fires.
Fix: move
retain()to after wrapForeignAllocation succeeds.