{!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} Struct HeapAllocator | Entities Graphics | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct HeapAllocator

    Represents a generic best-fit heap allocation algorithm that operates on abstract integer indices.

    Namespace: Unity.Rendering
    Assembly: solution.dll
    Syntax
    public struct HeapAllocator
    Remarks

    You can use this to suballocate memory, GPU buffer contents, and DX12 descriptors. This supports alignments, resizing, and coalescing of freed blocks.

    Constructors

    Name Description
    HeapAllocator(ulong, uint)

    Creates a new HeapAllocator with the given initial size and alignment.

    Properties

    Name Description
    Empty

    Indicates whether the allocator is empty. This is true if the allocator is empty and false otherwise.

    FreeSpace

    The amount of available free space in the allocator.

    Full

    Indicates whether the allocator is full. This is true if the allocator is full and false otherwise.

    IsCreated

    Indicates whether the allocator has been created and not yet allocated.

    Size

    The size of the heap that the allocator manages.

    UsedSpace

    The amount of used space in the allocator.

    Methods

    Name Description
    Allocate(ulong, uint)

    Attempt to allocate a block from the heap with at least the given size and alignment.

    Clear()

    Clears the allocator.

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Release(HeapBlock)

    Releases a given block of memory and marks it as free.

    Resize(ulong)

    Attempts to grow or shrink the allocator. Growing always succeeds, but shrinking might fail if the end of the heap is allocated.

    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)