文档

Unity Engine

Unity Engine

Allocate

Returns an allocation from the allocator's internal buffer.
阅读时间1 分钟最后更新于 1 个月前

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.