You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "CurtHagenlocher (via GitHub)" <gi...@apache.org> on 2026/10/18 16:30:20 UTC

[PR] fix: Don't throw when releasing an exported NullArray [arrow-dotnet]

CurtHagenlocher opened a new pull request, #469:
URL: https://github.com/apache/arrow-dotnet/pull/469

   ## What's Changed
   
   Exporting a `NullArray` with `CArrowArrayExporter.ExportArray` and then releasing it throws `ArgumentOutOfRangeException: bytesAllocated ('0') must be a non-negative and non-zero value`. This happens for any length.
   
   A `NullArray` has no buffers and no children, so the export allocates nothing through `ExportedAllocationOwner`. On release, `Dispose()` called `GC.RemoveMemoryPressure(_allocationSize)` with a size of 0, and the runtime rejects that. Every other array type allocates at least its buffer-pointer array, which is why this hasn't come up before. `Dispose()` now only removes memory pressure when something was allocated.
   
   The release runs inside the C Data release callback. When a native consumer calls that callback, the exception would cross the native boundary.
   
   ### Tests
   `RoundTripNullArray` exports, imports and releases null arrays of length 0 and 3. It fails without the fix on net8.0, net462 and net472.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   Co-Authored-By: Claude Opus 5.5 <no...@anthropic.com>
   


-- 
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@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: Don't throw when releasing an exported NullArray [arrow-dotnet]

Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher merged PR #469:
URL: https://github.com/apache/arrow-dotnet/pull/469


-- 
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@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org