Struct BatchAllocator
Non-concurrent batching allocator, backed by native allocations. The user will pass pointers to storage pointers in Allocate, and then actual allocation and storate population will occur in Dispose.
Namespace: Unity.Media.Utilities
Syntax
public struct BatchAllocator : IDisposable
Constructors
BatchAllocator(Allocator)
Create a new BatchAllocator
Declaration
public BatchAllocator(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The backing native allocator to be used |
Properties
AllocationRoot
Returns a pointer to the base allocation, once allocation has occurred
Declaration
public void *AllocationRoot { get; }
Property Value
Type | Description |
---|---|
Void* |
TotalSize
The total allocation size, including padding for alignment
Declaration
public int TotalSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Allocate<T>(Int32, T**)
Register an allocation
Declaration
public void Allocate<T>(int count, T**result)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
Int32 | count | The number of elements to be allocated |
T** | result | A pointer to the storage where the beginning of the allocation will be stored. The address pointed to by result will be nulled when Allocate is called, and populated when Dispose is called. |
Type Parameters
Name | Description |
---|---|
T | The element type |
Remarks
The alignment of T will be respected within the allocation.
Dispose()
Perform the actual allocation and populate the registered suballocation pointers
Declaration
public void Dispose()