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,11 +1,27 @@
|
||||
using Misaki.HighPerformance.Unsafe.Services;
|
||||
#if DEBUG
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
#endif
|
||||
|
||||
namespace Misaki.HighPerformance.Unsafe;
|
||||
|
||||
internal class MemoryLeakException(params AllocationInfo[] Infos) : Exception
|
||||
public readonly struct MemoryLeakExceptionInfo
|
||||
{
|
||||
public nuint Size
|
||||
{
|
||||
get; init;
|
||||
}
|
||||
#if DEBUG
|
||||
public StackTrace StackTrace
|
||||
{
|
||||
get; init;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public class MemoryLeakException(params MemoryLeakExceptionInfo[] Infos) : Exception
|
||||
{
|
||||
#if DEBUG
|
||||
private static string GetMessage(StackTrace? stackTrace)
|
||||
{
|
||||
if (stackTrace == null)
|
||||
@@ -27,6 +43,7 @@ internal class MemoryLeakException(params AllocationInfo[] Infos) : Exception
|
||||
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
#endif
|
||||
|
||||
public override string Message
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user