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 |
---|---|
Heap |
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. |
Free |
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. |
Is |
Indicates whether the allocator has been created and not yet allocated. |
Size | The size of the heap that the allocator manages. |
Used |
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(Heap |
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. |