ump45nose commented on code in PR #483:
URL: https://github.com/apache/arrow-dotnet/pull/483#discussion_r4337271173
##########
test/Apache.Arrow.Tests/CDataInterfaceDataTests.cs:
##########
@@ -298,5 +302,75 @@ RecordBatch GetTestRecordBatch()
CArrowArray.Free(cArray);
}
+ [Fact]
+ public async Task ExportedArrayStreamDisposesBatchesOnRelease()
+ {
+ var allocator = new TestMemoryAllocator();
+ RecordBatch batch = GetAllocatorBackedRecordBatch(allocator);
Review Comment:
Added `ExportedArrayStreamUnpinsMemoryBeforeDisposingBatch`. The batch owns
a `NativeMemoryAllocator` allocation and its values buffer is built from that
`ReadOnlyMemory<byte>`, so export goes through the `TryExport` pin path. The
test checks the owner is disposed when the imported batch is released. With the
owned-object disposal moved back before the pins are released, the test host
crashes with "cannot free native memory while it is pinned", so it catches the
ordering. (AI-assisted reply.)
--
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]