You can control how Unity allocates native memory with the settings in Edit > Project Settings > Memory Settings, or with command-line arguments. For information on how to customize native memory allocators, refer to Customizing native memory allocators.
The following tables describe each allocator setting and its default value. To override these settings at startup on the command line, use the -memorysetup-* arguments. For a list of these arguments, refer to Native memory allocator arguments.
These allocators are the ones that Unity uses for most allocations.
The primary allocator Unity uses for most allocations. It has the following settings:
| Setting | Description | Default value |
|---|---|---|
| Main Thread Block Size | Sets the block size of the dedicated main thread allocator. |
16777216 bytes |
| Shared Thread Block Size | Sets the block size of the shared thread allocator. |
16777216 bytes |
The allocator Unity uses for CPU allocations related to the Gfx system. It has the following settings:
| Setting | Description | Default value |
|---|---|---|
| Main Thread Block Size | Sets the block size of the dedicated main thread Gfx allocator. |
16777216 bytes |
| Shared Thread Block Size | Sets the block size of the shared thread Gfx allocator. |
16777216 bytes |
Allocations used for type trees and the file cache. It has the following settings:
| Setting | Description | Default value |
|---|---|---|
| File Cache Block Size | Sets the block size of the file cache allocator. The file cache has its own allocator to avoid fragmentation. |
4194304 bytes |
| Type Tree Block Size | Sets the block size of the type tree allocator. Type trees have their own allocator to avoid fragmentation from many small allocations. |
2097152 bytes |
The bucket allocator shared between the main allocators. It has the following settings:
| Setting | Description | Default value |
|---|---|---|
| Bucket Allocator Granularity | Sets the step size for buckets in the shared allocator. |
16 bytes |
| Bucket Allocator BucketCount | Sets the number of bucket sizes. | 8 |
| Bucket Allocator Block Size | Sets the size of the memory blocks that Unity uses for buckets. | Editor: 8388608 bytesPlayer: 4194304 bytes |
| Bucket Allocator Block Count | Sets the maximum number of blocks that Unity can allocate. | Editor: 8Player: 1
|
The Thread Local Storage (TLS) allocator that handles very short-lived allocations.
| Allocator | Description | Default value (in bytes) |
|---|---|---|
| Main Thread Block Size | Sets the initial size of the main thread stack. | Editor: 16777216Player: 4194304
|
| Job Worker Block Size | Sets the size of each job worker in the Unity job system. | 262144 |
| Background Job Worker Block Size | Sets the size of each background worker. | 32768 |
| Preload Block Size | Sets the stack size of the preload manager. | Editor: 33554432Player: 262144
|
| Audio Worker Block Size | Sets the stack size of each audio worker thread. | 65536 |
| Cloud Worker Block Size | Sets the stack size of the cloud worker threads. | 32768 |
| Gfx Thread Blocksize | Sets the stack size of the main render thread. | 262144 |
| GI Baking Blocksize | Sets the stack size of each GI worker thread. | 262144 |
| NavMesh Worker Block Size | Sets the stack size of the NavMesh worker threads. | 65536 |
Fast linear allocator for short lived allocations shared between threads.
| Allocator | Description | Default value (in bytes) |
|---|---|---|
| Job Allocator Block Size | Sets the block size of the round robin linear thread allocator that Unity mainly uses for the job worker threads. | 2097152 |
| Background Job Allocator Block Size | Sets the block size of the linear allocator for background workers, such as asynchronous asset loading, that allows longer lived allocations. Unity rounds the block size up to the nearest power of two. This allocator only grows, and can reserve up to 512 times the rounded block size. For more information, refer to Reduce the memory footprint of the background job allocator. | 1048576 |
| Job Allocator Block Size on low memory platforms | Sets the block size that devices with less than 2 GB of physical memory use for both the job workers and the background jobs. Unity checks the device’s physical memory when the application starts. Devices with 2 GB of memory or more use Job Allocator Block Size and Background Job Allocator Block Size, regardless of platform. | 262144 |
Allocators that Unity uses exclusively for the Profiler so that they don’t interfere with the application’s allocation patterns. They have the following settings:
| Setting | Description | Default value |
|---|---|---|
| Profiler Block Size | Sets the block size for the main part of the Profiler. | 16777216 |
| Editor Profiler Block Size | Sets the block size for the Editor part of the Profiler. This isn’t present in players. |
1048576 bytes |
Shared bucket allocator for the Profiler and Editor Profiler allocators. Not present on low memory platforms. It has the following settings:
| Setting | Description | Default value |
|---|---|---|
| Bucket Allocator Granularity | Sets the step size for buckets in the shared allocator. |
16 bytes |
| Bucket Allocator BucketCount | Sets the number of bucket sizes. For example, if the value is 4, the sizes are 16 bytes, 32 bytes, 48 bytes, and 64 bytes. | 8 |
| Bucket Allocator Block Size | Sets the size of the memory blocks that Unity uses for buckets. | Editor: 33554432 bytesPlayer: 4194304 bytes |
| Bucket Allocator Block Count | Sets the maximum number of blocks that Unity can allocate. | Editor: 8Player: 1
|