Documentation

Unity Engine

Download Unity

Unity Engine

Memory project settings reference

Reference for native memory allocator settings
Read time 5 minutesLast updated 6 days ago

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.

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
-memorysetup-*
arguments. For a list of these arguments, refer to Native memory allocator arguments.

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 SizeSets the block size of the dedicated main thread allocator. This property is automatically disabled when you use mimalloc.
16777216
bytes
Shared Thread Block SizeSets the block size of the shared thread allocator. This property is automatically disabled when you use mimalloc.
16777216
bytes
Mimalloc enabledUses 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 SizeSets the block size of the dedicated main thread Gfx allocator.
16777216
bytes
Shared Thread Block SizeSets the block size of the shared thread Gfx allocator.
16777216
bytes

Other Allocators

Allocations used for type trees and the file cache. It has the following settings:

Setting

Description

Default value

File Cache Block SizeSets the block size of the file cache allocator. The file cache has its own allocator to avoid fragmentation.
4194304
bytes
Type Tree Block SizeSets the block size of the type tree allocator. Type trees have their own allocator to avoid fragmentation from many small allocations.
2097152
bytes

Shared Bucket Allocator

The bucket allocator shared between the main allocators. It has the following settings:

Setting

Description

Default value

Bucket Allocator GranularitySets the step size for buckets in the shared allocator.
16
bytes
Bucket Allocator BucketCountSets the number of bucket sizes.
8
Bucket Allocator Block SizeSets the size of the memory blocks that Unity uses for buckets.Editor:
8388608
bytes
Player:
4194304
bytes
Bucket Allocator Block CountSets the maximum number of blocks that Unity can allocate.Editor:
8

Player:
1

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 SizeSets the initial size of the main thread stack.Editor:
16777216

Player:
4194304
Job Worker Block SizeSets the size of each job worker in the Unity job system.
262144
Background Job Worker Block SizeSets the size of each background worker.
32768
Preload Block SizeSets the stack size of the preload manager.Editor:
33554432

Player:
262144
Audio Worker Block SizeSets the stack size of each audio worker thread.
65536
Cloud Worker Block SizeSets the stack size of the cloud worker threads.
32768
Gfx Thread BlocksizeSets the stack size of the main render thread.
262144
GI Baking BlocksizeSets the stack size of each GI worker thread.
262144
NavMesh Worker Block SizeSets the stack size of the NavMesh worker threads.
65536

Fast Thread Shared Temporary Allocators

Fast linear allocator for short lived allocations shared between threads.

Allocator

Description

Default value (in bytes)

Job Allocator Block SizeSets the block size of the round robin linear thread allocator that Unity mainly uses for the job worker threads.
2097152
Background Job Allocator Block SizeSets 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 platformsSets 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

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 SizeSets the block size for the main part of the Profiler.
16777216
Editor Profiler Block SizeSets the block size for the Editor part of the Profiler. This isn't present in players.
1048576
bytes

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 GranularitySets the step size for buckets in the shared allocator.
16
bytes
Bucket Allocator BucketCountSets 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 SizeSets the size of the memory blocks that Unity uses for buckets.Editor:
33554432
bytes
Player:
4194304
bytes
Bucket Allocator Block CountSets the maximum number of blocks that Unity can allocate.Editor:
8

Player:
1

Additional resources