Skip to content

C Data import leaks native memory when the allocator runs out of space mid-import #1239

Closed

Description

@sandeshkr419

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.

Activity

  1. added this to the 20.0.0 milestone on Jul 20, 2026
  2. added a commit that references this issue on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions