Update memory management and collection structures
Added `AllocationHandler` struct for memory allocation management. Added `UnsafeArrayPool` class for pooling `UnsafeArray<T>` instances. Added new `External` option to `Allocator` enum. Added default constructors for `UnsafeList`, `UnsafeQueue`, and `UnsafeStack` using `Persistent` allocator. Changed namespace in `AllocationManager` to `Misaki.HighPerformance.Unsafe.Buffer`. Changed `MemoryLeakException` to use `MemoryLeakExceptionInfo` for better debugging. Changed constructor behavior in `UnsafeArray` to clarify memory management responsibilities. Changed `MemoryUtilities` to include null checks in `Free` and `AlignedFree` methods. Removed unused using directive in `CollectionBenchmark.cs`. Removed initialization of `AllocationManager` in `Program.cs`.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using Misaki.HighPerformance.Unsafe.Buffer;
|
||||
using Misaki.HighPerformance.Unsafe.Collections;
|
||||
using Misaki.HighPerformance.Unsafe.Services;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
@@ -69,6 +69,11 @@ public static unsafe class MemoryUtilities
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Free(void* ptr)
|
||||
{
|
||||
if (ptr == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NativeMemory.Free(ptr);
|
||||
}
|
||||
|
||||
@@ -80,6 +85,11 @@ public static unsafe class MemoryUtilities
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void AlignedFree(void* ptr)
|
||||
{
|
||||
if (ptr == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NativeMemory.AlignedFree(ptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user