/// <summary> /// Releases all resources associated with this object /// </summary> protected override void Dispose(Boolean disposing) => MarshalEx.FreeHGlobalAligned(intPtr);
/// <summary> /// Create a new AlignedMemoryManager instance at the given pointer and size /// </summary> /// <remarks>It is assumed that the span provided is already unmanaged or externally pinned</remarks> public unsafe AlignedMemoryManager(Int32 alignment, Int32 length) { this.length = length; intPtr = MarshalEx.AllocHGlobalAligned(length * sizeof(T), alignment); }