From 490025bfc19060262bd684716874b6e63ba1aaa6 Mon Sep 17 00:00:00 2001 From: Misaki Date: Mon, 13 Apr 2026 00:29:20 +0900 Subject: [PATCH] fixed the memory pool problem --- Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs | 1 + Misaki.HighPerformance.LowLevel/Buffer/MemoryPool.cs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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; }