docs.unity3d.com
    Show / Hide Table of Contents

    Class ArrayPool

    A pooled memory allocator. May be used optionally during serializaiton to avoid generation of garbage.

    Inheritance
    Object
    ArrayPool
    ArrayUnpool
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: USD.NET
    Syntax
    public class ArrayPool

    Fields

    sm_defaultCtor

    Declaration
    protected static readonly Type[] sm_defaultCtor
    Field Value
    Type Description
    Type[]

    sm_noParameters

    Declaration
    protected static readonly object[] sm_noParameters
    Field Value
    Type Description
    Object[]

    Methods

    Free(Type, UInt32, Array)

    Adds the given array to the allocator pool. Note that the array need not have been allocated via malloc.

    Declaration
    public virtual void Free(Type arrayType, uint size, Array array)
    Parameters
    Type Name Description
    Type arrayType
    UInt32 size
    Array array
    Remarks

    Note that objects returned to the allocator pool will not be garbage collected and will not be disposed.

    FreeHandle(Type, Object)

    Adds the given handle to the allocator pool. Note that the handle need not have been allocated via malloc.

    Declaration
    public virtual void FreeHandle(Type type, object handle)
    Parameters
    Type Name Description
    Type type
    Object handle
    Remarks

    Note that objects returned to the allocator pool will not be garbage collected and will not be disposed.

    FreeHandle<T>(T)

    Adds the given handle to the allocator pool. Note that the handle need not have been allocated via malloc.

    Declaration
    public virtual void FreeHandle<T>(T handle)
    Parameters
    Type Name Description
    T handle
    Type Parameters
    Name Description
    T
    Remarks

    Note that objects returned to the allocator pool will not be garbage collected and will not be disposed.

    Malloc<T>(UInt32)

    Allocates a new array of type T, returning ownership to the caller. Uses an existing array from the pool if available.

    Declaration
    public virtual T[] Malloc<T>(uint size)
    Parameters
    Type Name Description
    UInt32 size

    The number of elements to allocate in the array

    Returns
    Type Description
    T[]
    Type Parameters
    Name Description
    T

    The element type of the array

    MallocHandle(Type)

    Allocates a new object of the specified type, transferring ownership to the caller. If an an existing object is available in the pool, it will be reused.

    Declaration
    public virtual object MallocHandle(Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Object
    Remarks

    This is primarily intended for use with wrapped, unmanaged objects (hence the name "handle") which tend to have a fixed overhead for every object instance.

    Back to top
    Copyright © 2023 Unity Technologies
    • 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 Thursday, October 19, 2023