diff --git a/Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs b/Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs index 58dfe97..1b7639b 100644 --- a/Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs +++ b/Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs @@ -466,6 +466,7 @@ public static unsafe class AllocationManager if (pStack != null) { pStack->Dispose(); + Free(pStack); } } diff --git a/Misaki.HighPerformance.LowLevel/Buffer/MemoryPool.cs b/Misaki.HighPerformance.LowLevel/Buffer/MemoryPool.cs index a5cb46d..7783a00 100644 --- a/Misaki.HighPerformance.LowLevel/Buffer/MemoryPool.cs +++ b/Misaki.HighPerformance.LowLevel/Buffer/MemoryPool.cs @@ -1,3 +1,4 @@ +using Misaki.HighPerformance.LowLevel.Utilities; using System.Runtime.CompilerServices; namespace Misaki.HighPerformance.LowLevel.Buffer; @@ -15,7 +16,7 @@ public unsafe struct MemoryPool : IDisposable { var allocator = TAllocator.Create(opts); - _pAllocator = (TAllocator*)allocator.Allocate((nuint)sizeof(TAllocator), AlignOf(), AllocationOption.None); + _pAllocator = (TAllocator*)Malloc((nuint)sizeof(TAllocator)); *_pAllocator = allocator; _allocationHandle = new AllocationHandle @@ -51,6 +52,8 @@ public unsafe struct MemoryPool : IDisposable _pAllocator->Dispose(); + MemoryUtility.Free(_pAllocator); + _pAllocator = null; _allocationHandle = default; }