docs.unity3d.com
    Show / Hide Table of Contents

    Struct PagedFreeList<T>

    A growable, sparse list whose internal memory is never relocated once allocated

    Namespace: Unity.Media.Utilities
    Syntax
    public struct PagedFreeList<T> : IDisposable, IEquatable<PagedFreeList<T>>, IValidatable where T : struct
    Type Parameters
    Name Description
    T

    The element type of the list

    Remarks

    The intended usage is that allocation and writing will only happen from a single thread, while indexing and releasing may happen from any thread

    Constructors

    PagedFreeList(Int32, Allocator)

    Create a new PagedFreeList

    Declaration
    public PagedFreeList(int pageCapacity, Allocator allocator = null)
    Parameters
    Type Name Description
    Int32 pageCapacity

    The number of elements per allocated page

    Allocator allocator

    The allocator to be used

    Properties

    Capacity

    The currently allocated capacity of the list

    Declaration
    public int Capacity { get; }
    Property Value
    Type Description
    Int32
    Remarks

    Can be called from any thread

    Item[Int32]

    Returns a reference to the item at the specified index

    Declaration
    public T this[int index] { get; }
    Parameters
    Type Name Description
    Int32 index

    The index of the desired item

    Property Value
    Type Description
    T

    Valid

    Whether the list is valid

    Declaration
    public bool Valid { get; }
    Property Value
    Type Description
    Boolean
    Implements
    IValidatable.Valid

    Methods

    AllocateIndex()

    Allocate the next index for use

    Declaration
    public int AllocateIndex()
    Returns
    Type Description
    Int32

    The allocated index

    Remarks

    Can only be used from a single thread

    Dispose()

    Dispose the list's allocated storage

    Declaration
    public void Dispose()

    Equals(PagedFreeList<T>)

    Whether this is the same list as another instance

    Declaration
    public bool Equals(PagedFreeList<T> other)
    Parameters
    Type Name Description
    PagedFreeList<T> other

    The other instance to compare

    Returns
    Type Description
    Boolean

    FreeIndex(Int32)

    Release the specified index

    Declaration
    public void FreeIndex(int index)
    Parameters
    Type Name Description
    Int32 index

    The index to release

    Remarks

    Can be called from any thread

    IndexIsValid(Int32)

    Query whether a given index is currently allocated for use

    Declaration
    public bool IndexIsValid(int index)
    Parameters
    Type Name Description
    Int32 index

    The index to query

    Returns
    Type Description
    Boolean

    True if the index is allocated, otherwise false

    Remarks

    Can be called from any thread (although the value of calling this in a concurrent context is limited)

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023