fixed the memory pool problem
This commit is contained in:
@@ -466,6 +466,7 @@ public static unsafe class AllocationManager
|
|||||||
if (pStack != null)
|
if (pStack != null)
|
||||||
{
|
{
|
||||||
pStack->Dispose();
|
pStack->Dispose();
|
||||||
|
Free(pStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Misaki.HighPerformance.LowLevel.Utilities;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Misaki.HighPerformance.LowLevel.Buffer;
|
namespace Misaki.HighPerformance.LowLevel.Buffer;
|
||||||
@@ -15,7 +16,7 @@ public unsafe struct MemoryPool<TAllocator, TOpts> : IDisposable
|
|||||||
{
|
{
|
||||||
var allocator = TAllocator.Create(opts);
|
var allocator = TAllocator.Create(opts);
|
||||||
|
|
||||||
_pAllocator = (TAllocator*)allocator.Allocate((nuint)sizeof(TAllocator), AlignOf<TAllocator>(), AllocationOption.None);
|
_pAllocator = (TAllocator*)Malloc((nuint)sizeof(TAllocator));
|
||||||
*_pAllocator = allocator;
|
*_pAllocator = allocator;
|
||||||
|
|
||||||
_allocationHandle = new AllocationHandle
|
_allocationHandle = new AllocationHandle
|
||||||
@@ -51,6 +52,8 @@ public unsafe struct MemoryPool<TAllocator, TOpts> : IDisposable
|
|||||||
|
|
||||||
_pAllocator->Dispose();
|
_pAllocator->Dispose();
|
||||||
|
|
||||||
|
MemoryUtility.Free(_pAllocator);
|
||||||
|
|
||||||
_pAllocator = null;
|
_pAllocator = null;
|
||||||
_allocationHandle = default;
|
_allocationHandle = default;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user