using System.Buffers; namespace StitchATon2.Infra.Buffers; public static class MemoryAllocator { public static IBuffer Allocate(int count) where T : unmanaged => new UnmanagedMemory(count); public static IMemoryOwner AllocateManaged(int count) => MemoryPool.Shared.Rent(count); public static ArrayOwner AllocateArray(int count) where T : unmanaged => new(ArrayPool.Shared, count); public static MemoryManager AllocateImmovable(int count) where T : unmanaged => new ImmovableMemory(count); }