{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method Allocate | Collections | 2.3.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Allocate

    Allocate<T>(ref T, int, int, int)

    Allocates memory directly from an allocator.

    Declaration
    public static void* Allocate<T>(this ref T t, int sizeOf, int alignOf, int items = 1) where T : unmanaged, AllocatorManager.IAllocator
    Parameters
    Type Name Description
    T t

    The allocator of type T used to allocator memory.

    int sizeOf

    The number of bytes to allocate to item.

    int alignOf

    The alignment in bytes.

    int items

    The number of items. Defaults to 1.

    Returns
    Type Description
    void*

    A pointer to the allocated memory.

    Type Parameters
    Name Description
    T

    The type of allocator.

    Allocate(AllocatorHandle, int, int, int)

    Allocates memory from an allocator.

    Declaration
    public static void* Allocate(AllocatorManager.AllocatorHandle handle, int itemSizeInBytes, int alignmentInBytes, int items = 1)
    Parameters
    Type Name Description
    AllocatorManager.AllocatorHandle handle

    A handle to the allocator.

    int itemSizeInBytes

    The number of bytes to allocate.

    int alignmentInBytes

    The alignment in bytes (must be a power of two).

    int items

    The number of values to allocate space for. Defaults to 1.

    Returns
    Type Description
    void*

    A pointer to the allocated memory.

    Allocate<T>(AllocatorHandle, int)

    Allocates enough memory for an unmanaged value of a given type.

    Declaration
    public static T* Allocate<T>(AllocatorManager.AllocatorHandle handle, int items = 1) where T : unmanaged
    Parameters
    Type Name Description
    AllocatorManager.AllocatorHandle handle

    A handle to the allocator.

    int items

    The number of values to allocate for space for. Defaults to 1.

    Returns
    Type Description
    T*

    A pointer to the allocated memory.

    Type Parameters
    Name Description
    T

    The type of value to allocate for.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)