protected override void Dispose(bool disposing) { if (disposing) { if (this.buffer != null) { this.buffer.Dispose(); this.buffer = null; } } base.Dispose(disposing); }
public static SafeProcessHeapBuffer Create(ulong length) { try { SafeProcessHeapBuffer buffer = UnsafeNativeMethods.HeapAlloc(ProcessHeap, 0, (UIntPtr)length); if (buffer.IsInvalid) { throw new OutOfMemoryException(); } buffer.Initialize(length); return(buffer); } catch (OverflowException ex) { throw new OutOfMemoryException($"Overflow when attempting to allocate {length:F0} bytes.", ex); } }
public UnmanagedCompressedAV1Data(ulong size) : base(size) { this.buffer = SafeProcessHeapBuffer.Create(size); }