Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Allocate

Returns an allocation from the allocator's internal buffer.
Read time 1 minuteLast updated 13 days ago

Definition

Allocate(int, int)

Returns an allocation from the allocator's internal buffer.
public void* Allocate(int sizeInBytes, int alignmentInBytes)

Parameters

sizeInBytes

The size of the new allocation.

alignmentInBytes

The alignment of the new allocation.

Returns

Type

Description

void*A pointer to the new allocation.

Allocate<T>(int)

Returns an allocation from the allocator's internal buffer.
public void* Allocate<T>(int count = 1) where T : unmanaged

Parameters

count

The number of elements to allocate space for. Defaults to 1.

Returns

Type

Description

void*A pointer to the new allocation.

Remarks

The allocation size in bytes is at least
count * sizeof(T)
. The space consumed by the allocation may be a little larger than this size due to alignment.