You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
495 B

  1. using System.Collections.Generic;
  2. namespace TMPro
  3. {
  4. internal static class TMP_ListPool<T>
  5. {
  6. // Object pool to avoid allocations.
  7. private static readonly TMP_ObjectPool<List<T>> s_ListPool = new TMP_ObjectPool<List<T>>(null, l => l.Clear());
  8. public static List<T> Get()
  9. {
  10. return s_ListPool.Get();
  11. }
  12. public static void Release(List<T> toRelease)
  13. {
  14. s_ListPool.Release(toRelease);
  15. }
  16. }
  17. }