This is an automated email from the ASF dual-hosted git repository.
curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-dotnet.git
The following commit(s) were added to refs/heads/main by this push:
new fbbe78e fix: When removing GC memory pressure, incorporate the
default alignment (#82)
fbbe78e is described below
commit fbbe78e79bd0b231bd3fc2fd085a9d803f0e45a7
Author: Curt Hagenlocher <[email protected]>
AuthorDate: Tue Sep 23 13:00:40 2025 -0700
fix: When removing GC memory pressure, incorporate the default alignment
(#82)
## What's Changed
When removing the memory pressure on the .NET garbage collector, assume
that the native allocation used the default alignment. Ideally we'd
remember the specific alignment used so we could produce an exact
result, but the bookkeeping doesn't seem worthwhile.
References #50.
---
src/Apache.Arrow/Memory/NativeMemoryAllocator.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Apache.Arrow/Memory/NativeMemoryAllocator.cs
b/src/Apache.Arrow/Memory/NativeMemoryAllocator.cs
index fc4e642..d1cbe52 100644
--- a/src/Apache.Arrow/Memory/NativeMemoryAllocator.cs
+++ b/src/Apache.Arrow/Memory/NativeMemoryAllocator.cs
@@ -55,7 +55,7 @@ namespace Apache.Arrow.Memory
public void Release(IntPtr ptr, int offset, int length)
{
Marshal.FreeHGlobal(ptr);
- GC.RemoveMemoryPressure(length);
+ GC.RemoveMemoryPressure(length + DefaultAlignment); // See
https://github.com/apache/arrow-dotnet/issues/50
}
}
}