docs.unity.cn
    Show / Hide Table of Contents

    Struct ScratchpadAllocator

    A fast allocator which allocates memory from its scratchpad.

    Namespace: Unity.Entities
    Syntax
    [BurstCompile]
    [GenerateTestsForBurstCompatibility]
    public struct ScratchpadAllocator : AllocatorManager.IAllocator, IDisposable

    Properties

    Name Description
    Function

    All allocators must implement this property, in order to be installed in the custom allocator table.

    Handle

    Retrieve the AllocatorHandle associated with this allocator. The handle is used as an index into a global table, for times when a reference to the allocator object isn't available.

    IsAutoDispose

    Check whether this allocator will automatically dispose allocations.

    IsCustomAllocator

    Check whether this allocator is a custom allocator.

    ToAllocator

    Retrieve the Allocator associated with this allocator handle.

    Methods

    Name Description
    AllocateNativeArray<T>(Int32)

    Allocate a NativeArray of type T from memory that's guaranteed to remain valid until Rewind() is called on the Scratchpad.

    AllocateNativeList<T>(Int32)

    Allocate a NativeList of type T from memory that's guaranteed to remain valid until Rewind() is called on the Scratchpad.

    Dispose()

    Dispose the allocator.

    GetAvailableBytes()

    Get remaining bytes that are available to allocate.

    Initialize(Int32)

    Initializes the allocator. Must be called before first use.

    Rewind()

    Rewind the allocator; invalidate all allocations made from it.

    Try(ref AllocatorManager.Block)

    Try to allocate, free, or reallocate a block of memory.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023