fixed the memory pool problem

This commit is contained in:
2026-04-13 00:29:20 +09:00
parent 4647cd4b95
commit 490025bfc1
2 changed files with 5 additions and 1 deletions

View File

@@ -466,6 +466,7 @@ public static unsafe class AllocationManager
if (pStack != null)
{
pStack->Dispose();
Free(pStack);
}
}

View File

@@ -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<TAllocator, TOpts> : IDisposable
{
var allocator = TAllocator.Create(opts);
_pAllocator = (TAllocator*)allocator.Allocate((nuint)sizeof(TAllocator), AlignOf<TAllocator>(), AllocationOption.None);
_pAllocator = (TAllocator*)Malloc((nuint)sizeof(TAllocator));
*_pAllocator = allocator;
_allocationHandle = new AllocationHandle
@@ -51,6 +52,8 @@ public unsafe struct MemoryPool<TAllocator, TOpts> : IDisposable
_pAllocator->Dispose();
MemoryUtility.Free(_pAllocator);
_pAllocator = null;
_allocationHandle = default;
}