docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct AllocatorManager.AllocatorHandle

    Represents the allocator function used within an allocator.

    Implements
    AllocatorManager.IAllocator
    Namespace: Unity.Collections
    Assembly: Unity.Collections.dll
    Syntax
    public struct AllocatorManager.AllocatorHandle : AllocatorManager.IAllocator

    Fields

    Index

    This allocator's index into the global table of allocator functions.

    Declaration
    public ushort Index
    Field Value
    Type Description
    ushort

    This allocator's index into the global table of allocator functions.

    InvalidChildAllocatorIndex

    For internal use only.

    Declaration
    public const int InvalidChildAllocatorIndex = -1
    Field Value
    Type Description
    int

    For internal use only.

    InvalidChildSafetyHandleIndex

    For internal use only.

    Declaration
    public const int InvalidChildSafetyHandleIndex = -1
    Field Value
    Type Description
    int

    For internal use only.

    Version

    This allocator's version number.

    Declaration
    public ushort Version
    Field Value
    Type Description
    ushort

    This allocator's version number.

    Remarks

    An allocator function is uniquely identified by its combination of Index and Version together: each index has a version number that starts at 0; the version number is incremented each time the index is reused for another registered allocator function.

    Properties

    Function

    For internal use only.

    Declaration
    public AllocatorManager.TryFunction Function { get; }
    Property Value
    Type Description
    AllocatorManager.TryFunction

    For internal use only.

    Handle

    This handle.

    Declaration
    public AllocatorManager.AllocatorHandle Handle { get; set; }
    Property Value
    Type Description
    AllocatorManager.AllocatorHandle

    This handle.

    IsCustomAllocator

    Check whether this allocator is a custom allocator.

    Declaration
    public bool IsCustomAllocator { get; }
    Property Value
    Type Description
    bool

    ToAllocator

    Cast the Index to Allocator.

    Declaration
    public Allocator ToAllocator { get; }
    Property Value
    Type Description
    Allocator

    Value

    The Index cast to int.

    Declaration
    public int Value { get; }
    Property Value
    Type Description
    int

    The Index cast to int.

    Methods

    AllocateBlock<T>(int)

    Allocates a block with this allocator function.

    Declaration
    public AllocatorManager.Block AllocateBlock<T>(int items) where T : struct
    Parameters
    Type Name Description
    int items

    The number of values to allocate for.

    Returns
    Type Description
    AllocatorManager.Block

    The allocated block.

    Type Parameters
    Name Description
    T

    The type of value to allocate for.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the allocator is not valid or if the allocation failed.

    Dispose()

    Unregister the allocator.

    Declaration
    public void Dispose()

    Try(ref Block)

    Tries to allocate the block with this allocator.

    Declaration
    public int Try(ref AllocatorManager.Block block)
    Parameters
    Type Name Description
    AllocatorManager.Block block

    The block to allocate.

    Returns
    Type Description
    int

    0 if successful. Otherwise, returns an error code.

    TryAllocateBlock<T>(out Block, int)

    Allocates a block from this allocator.

    Declaration
    public int TryAllocateBlock<T>(out AllocatorManager.Block block, int items) where T : struct
    Parameters
    Type Name Description
    AllocatorManager.Block block

    Outputs the allocated block.

    int items

    The number of values to allocate for.

    Returns
    Type Description
    int

    0 if successful. Otherwise, returns the error code from the allocator function.

    Type Parameters
    Name Description
    T

    The type of value to allocate for.

    Operators

    implicit operator AllocatorHandle(Allocator)

    Returns the AllocatorHandle of an allocator.

    Declaration
    public static implicit operator AllocatorManager.AllocatorHandle(Allocator a)
    Parameters
    Type Name Description
    Allocator a

    The Allocator to copy.

    Returns
    Type Description
    AllocatorManager.AllocatorHandle

    The AllocatorHandle of an allocator.

    Implements

    AllocatorManager.IAllocator

    Extension Methods

    AllocatorManager.Register<T>(ref T)
    AllocatorManager.Unregister<T>(ref T)
    In This Article
    Back to top
    Copyright © 2024 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)