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

RewindableAllocator.AllocateNativeList

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 NativeList<T> AllocateNativeList(int capacity);

Parameters

Parameter Description
capacity The capacity of the NativeList to allocate, measured in elements.

Returns

NativeList<T> The NativeList allocated by this function.

Description

Allocate a NativeList of type T from memory that is guaranteed to remain valid until the end of the next Update of this World. There is no need to Dispose the NativeList so allocated. It is not possible to free the memory by Disposing it - it is automatically freed after the end of the next Update for this World. The NativeList must be initialized with its maximum capacity; if it were to dynamically resize, up to 1/2 of the total final capacity would be wasted, because the memory can't be dynamically freed.