Refactor TLSFAllocator locking, update AddRange signatures

Refactored TLSFAllocator to use a static lock instead of per-instance GCHandle-based locking, removing the Dispose method and related code. Updated allocation methods to use the static lock for thread safety. Removed Dispose call on s_pTLSFAllocator. In UnsafeChunkedList, removed an unused using directive and replaced explicit int types with var in AddRange. Changed UnsafeList<T>.AddRange to accept ReadOnlySpan<T> for broader compatibility. Bumped assembly version to 1.6.25.
This commit is contained in:
2026-05-10 13:06:32 +09:00
parent 99a7e3c4e1
commit 4b9d93ec65
4 changed files with 10 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
using Misaki.HighPerformance.LowLevel.Buffer;
using Misaki.HighPerformance.LowLevel.Collections.Contracts;
using Misaki.HighPerformance.LowLevel.Utilities;
using System.Collections;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
@@ -148,9 +147,9 @@ public unsafe struct UnsafeChunkedList<T> : IUnsafeCollection<T>
fixed (T* pCollection = collection)
{
int remaining = count;
var remaining = count;
T* srcPtr = pCollection;
int currentIndex = index;
var currentIndex = index;
while (remaining > 0)
{

View File

@@ -332,7 +332,7 @@ public unsafe struct UnsafeList<T> : IUnsafeCollection<T>
/// Adds a range of elements to the collection.
/// </summary>
/// <param name="values">A span containing the elements to add.</param>
public void AddRange(Span<T> values)
public void AddRange(ReadOnlySpan<T> values)
{
var newSize = _count + values.Length;
if (newSize > Capacity)