Documentation

Unity Engine

Unity Engine

Domain

Use an allocation that lasts until the next code reload.
Read time 1 minuteLast updated 4 days ago

Definition

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.