feat(memory): improve oversized alloc handling & cleanup

Enhanced FreeList to handle oversized allocations by bypassing chunk management and allocating directly from the OS, with proper header assignment and immediate release on free. Updated IUnsafeCollection<T> documentation, removed unnecessary array clearing in Clear() methods, refined UnsafeSlotMap initialization logic, and removed redundant default element addition. Bumped assembly version to 1.5.1.
This commit is contained in:
2026-03-18 20:12:41 +09:00
parent 7326c83948
commit 641b459997
8 changed files with 14 additions and 16 deletions

View File

@@ -28,7 +28,7 @@ public interface IUnsafeCollection<T> : IUnsafeCollection, IEnumerable<T>
where T : unmanaged
{
/// <summary>
/// Gets the number of elements in a collection. The value is read-only.
/// Gets the number of elements in a collection.
/// </summary>
int Count
{

View File

@@ -467,7 +467,6 @@ public unsafe struct UnsafeList<T> : IUnsafeCollection<T>
public void Clear()
{
_array.Clear();
_count = 0;
}

View File

@@ -193,7 +193,6 @@ public unsafe struct UnsafeQueue<T> : IUnsafeCollection<T>
public void Clear()
{
_array.Clear();
_count = 0;
_offset = 0;
}

View File

@@ -132,8 +132,8 @@ public unsafe struct UnsafeSlotMap<T> : IUnsafeCollection<T>
if (!allocationOption.HasFlag(AllocationOption.Clear))
{
_generations.AsSpan().Clear();
_validBits.ClearAll();
}
_validBits.ClearAll();
_count = 0;
_capacity = capacity;
@@ -324,8 +324,6 @@ public unsafe struct UnsafeSlotMap<T> : IUnsafeCollection<T>
_validBits.ClearAll();
_count = 0;
Add(default, out _);
}
public readonly void* GetUnsafePtr()

View File

@@ -396,8 +396,6 @@ public unsafe struct UnsafeSparseSet<T> : IUnsafeCollection<T>
_count = 0;
_nextId = 0;
Add(default, out _);
}
/// <inheritdoc/>

View File

@@ -221,7 +221,6 @@ public unsafe struct UnsafeStack<T> : IUnsafeCollection<T>
public void Clear()
{
_array.Clear();
_count = 0;
}