Struct AllocatorHelper<T>
Provides a wrapper for custom allocator.
Namespace: Unity.Collections
Syntax
public struct AllocatorHelper<T> : IDisposable where T : struct, AllocatorManager.IAllocator
Type Parameters
| Name | Description |
|---|---|
| T | The type of the allocator. |
Constructors
AllocatorHelper(AllocatorManager.AllocatorHandle, Boolean, Int32)
Allocate the custom allocator from backingAllocator and register it.
Declaration
[ExcludeFromBurstCompatTesting("CreateAllocator is unburstable")]
public AllocatorHelper(AllocatorManager.AllocatorHandle backingAllocator, bool isGlobal = false, int globalIndex = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| AllocatorManager.AllocatorHandle | backingAllocator | Allocator used to allocate backing storage. |
| Boolean | isGlobal | Flag indicating if the allocator is a global allocator. |
| Int32 | globalIndex | Index into the global function table of the allocator to be created. |
Properties
Allocator
Get the custom allocator.
Declaration
public readonly ref T Allocator { get; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
Dispose()
Dispose the custom allocator backing memory and unregister it.
Declaration
[ExcludeFromBurstCompatTesting("DestroyAllocator is unburstable")]
public void Dispose()