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 <[email protected]>
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to