Method Allocate
Allocate<T>(ref T, int, int, int)
Allocates memory directly from an allocator.
Declaration
public static void* Allocate<T>(this ref T t, int sizeOf, int alignOf, int items = 1) where T : unmanaged, AllocatorManager.IAllocator
Parameters
Type | Name | Description |
---|---|---|
T | t | The allocator of type T used to allocator memory. |
int | sizeOf | The number of bytes to allocate to item. |
int | alignOf | The alignment in bytes. |
int | items | The number of items. Defaults to 1. |
Returns
Type | Description |
---|---|
void* | A pointer to the allocated memory. |
Type Parameters
Name | Description |
---|---|
T | The type of allocator. |
Allocate(AllocatorHandle, int, int, int)
Allocates memory from an allocator.
Declaration
public static void* Allocate(AllocatorManager.AllocatorHandle handle, int itemSizeInBytes, int alignmentInBytes, int items = 1)
Parameters
Type | Name | Description |
---|---|---|
AllocatorManager.AllocatorHandle | handle | A handle to the allocator. |
int | itemSizeInBytes | The number of bytes to allocate. |
int | alignmentInBytes | The alignment in bytes (must be a power of two). |
int | items | The number of values to allocate space for. Defaults to 1. |
Returns
Type | Description |
---|---|
void* | A pointer to the allocated memory. |
Allocate<T>(AllocatorHandle, int)
Allocates enough memory for an unmanaged value of a given type.
Declaration
public static T* Allocate<T>(AllocatorManager.AllocatorHandle handle, int items = 1) where T : unmanaged
Parameters
Type | Name | Description |
---|---|---|
AllocatorManager.AllocatorHandle | handle | A handle to the allocator. |
int | items | The number of values to allocate for space for. Defaults to 1. |
Returns
Type | Description |
---|---|
T* | A pointer to the allocated memory. |
Type Parameters
Name | Description |
---|---|
T | The type of value to allocate for. |