Memory project settings reference
Reference for native memory allocator settings
阅读时间5 分钟最后更新于 6 天前
You can control how Unity allocates native memory with the settings in Edit > > Memory Settings, or with command-line arguments. For information on how to customize native memory allocators, refer to Customizing native memory allocators.
Project Settings
?

Project Settings > Memory Settings, showing a selection of Player memory settings
The following tables describe each allocator setting and its default value. To override these settings at startup on the command line, use the arguments. For a list of these arguments, refer to Native memory allocator arguments.
-memorysetup-*Main Allocators
These allocators are the ones that Unity uses for most allocations.
Main Allocator
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. This property is automatically disabled when you use mimalloc. | |
| Shared Thread Block Size | Sets the block size of the shared thread allocator. This property is automatically disabled when you use mimalloc. | |
| Mimalloc enabled | Uses mimalloc instead of the main thread and shared thread. | Enabled |
Gfx Allocator
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. | |
| Shared Thread Block Size | Sets the block size of the shared thread Gfx allocator. | |
Other Allocators
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. | |
| 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. | |
Shared Bucket Allocator
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. | |
| Bucket Allocator BucketCount | Sets the number of bucket sizes. | |
| Bucket Allocator Block Size | Sets the size of the memory blocks that Unity uses for buckets. | Editor: Player: |
| Bucket Allocator Block Count | Sets the maximum number of blocks that Unity can allocate. | Editor: Player: |
Fast Per Thread Temporary Allocators
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: Player: |
| Job Worker Block Size | Sets the size of each job worker in the Unity job system. | |
| Background Job Worker Block Size | Sets the size of each background worker. | |
| Preload Block Size | Sets the stack size of the preload manager. | Editor: Player: |
| Audio Worker Block Size | Sets the stack size of each audio worker thread. | |
| Cloud Worker Block Size | Sets the stack size of the cloud worker threads. | |
| Gfx Thread Blocksize | Sets the stack size of the main render thread. | |
| GI Baking Blocksize | Sets the stack size of each GI worker thread. | |
| NavMesh Worker Block Size | Sets the stack size of the NavMesh worker threads. | |
Fast Thread Shared Temporary Allocators
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. | |
| 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. | |
| 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. | |
Profiler Allocators
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. | |
| Editor Profiler Block Size | Sets the block size for the Editor part of the Profiler. This isn't present in players. | |
Shared Profiler Bucket Allocator
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. | |
| 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. | |
| Bucket Allocator Block Size | Sets the size of the memory blocks that Unity uses for buckets. | Editor: Player: |
| Bucket Allocator Block Count | Sets the maximum number of blocks that Unity can allocate. | Editor: Player: |