Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

AllocatorManager.Allocate

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void* Allocate(ref T t, int sizeOf, int alignOf, int items);

Parameters

Parameter Description
t The allocator of type T used to allocator memory.
sizeOf The number of bytes to allocate to item.
alignOf The alignment in bytes.
items The number of items. Defaults to 1.

Returns

void* A pointer to the allocated memory.

Description

Allocates memory directly from an allocator.


Declaration

public static void* Allocate(AllocatorHandle handle, int itemSizeInBytes, int alignmentInBytes, int items);

Parameters

Parameter Description
handle A handle to the allocator.
itemSizeInBytes The number of bytes to allocate.
alignmentInBytes The alignment in bytes (must be a power of two).
items The number of values to allocate space for. Defaults to 1.

Returns

void* A pointer to the allocated memory.

Description

Allocates memory from an allocator.


Declaration

public static T* Allocate(AllocatorHandle handle, int items);

Parameters

Parameter Description
handle A handle to the allocator.
items The number of values to allocate for space for. Defaults to 1.

Returns

T* A pointer to the allocated memory.

Description

Allocates enough memory for an unmanaged value of a given type.