com.alicizax.unity.framework/Runtime/ObjectPool/SlotArrayPool.cs

23 lines
532 B
C#
Raw Normal View History

2026-04-24 14:33:26 +08:00
using System;
using System.Buffers;
namespace AlicizaX.ObjectPool
{
/// <summary>
/// 数组池管理器,避免频繁分配数组
/// </summary>
internal static class SlotArrayPool<T>
{
public static T[] Rent(int minimumLength)
{
return ArrayPool<T>.Shared.Rent(minimumLength);
2026-04-24 14:33:26 +08:00
}
public static void Return(T[] array, bool clearArray = false)
{
if (array != null)
ArrayPool<T>.Shared.Return(array, clearArray);
2026-04-24 14:33:26 +08:00
}
}
}