feat(core): improve memory management and API safety

- JobScheduler now explicitly frees unmanaged memory in _jobInfoPool before disposal.
- Removed the unused TempJobAllocator struct and implementation.
- Refactored AllocationManager to use conditional compilation for safety checks, making MemoryHandle usage conditional.
- Improved documentation in AllocationManager for clarity on allocation size and safety check behavior.
- Added UnsafeSetCount method to UnsafeList<T> for direct count manipulation with validation.
- Bumped AssemblyVersion in Jobs and LowLevel projects.
This commit is contained in:
2026-03-31 19:58:47 +09:00
parent 669185ab0c
commit abb0cd88ea
6 changed files with 63 additions and 161 deletions

View File

@@ -491,6 +491,24 @@ public unsafe struct UnsafeList<T> : IUnsafeCollection<T>
}
}
/// <summary>
/// Sets the count of the collection to a new value without modifying the underlying storage.
/// </summary>
/// <remarks>
/// This method will not initialize new elements, so it should be used with caution. The new count must be between 0 and the current capacity of the collection.
/// </remarks>
/// <param name="newCount">The new count value to set for the collection.</param>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the new count is outside the valid range.</exception>
public void UnsafeSetCount(int newCount)
{
if (newCount < 0 || newCount > Capacity)
{
throw new ArgumentOutOfRangeException(nameof(newCount), $"Value for newCount {newCount} must be between 0 and Capacity {Capacity}.");
}
_count = newCount;
}
public void Clear()
{
_count = 0;