CurtHagenlocher commented on code in PR #297:
URL: https://github.com/apache/arrow-dotnet/pull/297#discussion_r3010013515
##########
src/Apache.Arrow/Memory/SharedMemoryHandle.cs:
##########
@@ -14,11 +14,35 @@
// limitations under the License.
using System;
+using System.Buffers;
namespace Apache.Arrow.Memory
{
- internal interface IOwnableAllocation
+ internal sealed class SharedMemoryHandle : IMemoryOwner<byte>
{
- bool TryAcquire(out IntPtr ptr, out int offset, out int length);
+ private SharedMemoryOwner _owner;
+
+ public SharedMemoryHandle(SharedMemoryOwner owner)
+ {
+ _owner = owner ?? throw new ArgumentNullException(nameof(owner));
+ }
+
+ public Memory<byte> Memory => _owner.Memory;
+
+ public SharedMemoryHandle Retain()
+ {
+ return _owner.Retain();
+ }
+
+ public void Dispose()
+ {
+ _owner?.Release();
+ _owner = null;
+ }
+
+ ~SharedMemoryHandle()
+ {
+ Dispose();
Review Comment:
Oops, this still needs a finalization suppression.
--
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]