Persistent
Use a persistent allocation.
Read time 1 minuteLast updated 16 days ago
Definition
- Type: Field
- Namespace: Unity.Collections
- Assembly: UnityEngine.ManagedKernelModule
Persistent = 4
Remarks
The slowest allocation but can last as long as you need it to, and if necessary, throughout the application's lifetime. It's a wrapper for a direct call to . Longer jobs can use this NativeContainer allocation type. Don't use where performance is essential.
mallocPersistentUnity doesn't free this allocation type automatically. To free it, call NativeArray<T>.Dispose on the container that owns the allocation, the same way you free any other manual allocation. Unlike Allocator.Temp and Allocator.TempJob, this allocation type has no frame limit, so Unity doesn't warn you if you keep it for many frames.