Allocate
Allocates memory directly from an allocator.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Method
- Namespace: Unity.Collections
- Assembly: UnityEngine.ManagedKernelModule
Allocate<T>(T, int, int, int)
Allocates memory directly from an allocator.
public static void* Allocate<T>(this ref T t, int sizeOf, int alignOf, int items = 1) where T : unmanaged, AllocatorManager.IAllocator
Parameters
Returns
Type | Description |
|---|---|
| void* | A pointer to the allocated memory. |
Allocate(AllocatorHandle, int, int, int)
Allocates memory from an allocator.
public static void* Allocate(AllocatorManager.AllocatorHandle handle, int itemSizeInBytes, int alignmentInBytes, int items = 1)
Parameters
A handle to the allocator.
The number of bytes to allocate.
The alignment in bytes (must be a power of two).
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.
public static T* Allocate<T>(AllocatorManager.AllocatorHandle handle, int items = 1) where T : unmanaged
Parameters
A handle to the allocator.
The number of values to allocate for space for. Defaults to 1.
Returns
Type | Description |
|---|---|
| <T>* | A pointer to the allocated memory. |