Domain
Use an allocation that lasts until the next code reload.
阅读时间1 分钟最后更新于 4 天前
Definition
- Type: Field
- Namespace: Unity.Collections
- Assembly: UnityEngine.ManagedKernelModule
Domain = 6
Remarks
Unity unloads and reloads your project's code, including the managed state of your scripts, during a code reload, for example when scripts recompile or when you enter Play mode with code reload enabled.
You don't need to free this memory, because Unity frees it automatically when it unloads your project's code. However, to conserve memory, you can free it at any time. Freeing a large number of such allocations in one frame, such that the array of freed pointers is larger than L2 cache, might exhibit a measurable loss of performance.
Note: The Domain allocator can track a maximum of 262144 (256 * 1024) individual allocations. If the number of allocations exceeds that number, Unity logs an error and doesn't free excessive allocations automatically.