Version: 2021.3
LanguageEnglish
  • C#

DeallocateOnJobCompletionAttribute

class in Unity.Collections

/

Implemented in:UnityEngine.CoreModule

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

Description

Automatically deallocates the native container when the job is finished.

Apply this attribute to native container fields in a job struct, provided the type of the field is marked with the NativeContainerSupportsDeallocateOnJobCompletionAttribute. In particular, fields of type NativeArray can be automatically deallocated with this mechanism. When the job finishes execution, the job system automatically deallocates the native container. Additional resources: NativeContainerSupportsDeallocateOnJobCompletionAttribute