Hello,
We are logging errors from our WebGL game and one of the frequent errors is an out-of-memory crash. It often happens immediately after the game is launched, while loading initial content.
Example error (desktop and mobile):
Could not allocate memory: System out of memory!
Trying to allocate: 16776956B with 16 alignment. MemoryLabel: Serialization
Allocation happened at: Line:72 in
Memory overview[ ALLOC_TEMP_TLS ] used: 24956B | peak: 0B | reserved: 4194304B
[ ALLOC_DEFAULT ] used: 217439794B | peak: 217439794B | reserved: 221076698B
[ ALLOC_TEMP_JOB_1_FRAME ] used: 0B | peak: 0B | reserved: 0B
[ ALLOC_TEMP_JOB_2_FRAMES ] used: 0B | peak: 0B | reserved: 0B
[ ALLOC_TEMP_JOB_4_FRAMES (JobTemp) ] used: 0B | peak: 0B | reserved: 524288B
[ ALLOC_TEMP_JOB_ASYNC (Background) ] used: 142B | peak: 0B | reserved: 3407872B
[ ALLOC_GFX ] used: 8438503B | peak: 8438503B | reserved: 8457864B
Could not allocate memory: System out of memory!
Trying to allocate: 16767284B with 16 alignment. MemoryLabel: Serialization
Allocation happened at: Line:72 in
Memory overview[ ALLOC_TEMP_TLS ] used: 24956B | peak: 0B | reserved: 4194304B
[ ALLOC_DEFAULT ] used: 251034158B | peak: 251034158B | reserved: 254670967B
[ ALLOC_TEMP_JOB_1_FRAME ] used: 0B | peak: 0B | reserved: 0B
[ ALLOC_TEMP_JOB_2_FRAMES ] used: 0B | peak: 0B | reserved: 0B
[ ALLOC_TEMP_JOB_4_FRAMES (JobTemp) ] used: 0B | peak: 0B | reserved: 524288B
[ ALLOC_TEMP_JOB_ASYNC (Background) ] used: 142B | peak: 0B | reserved: 3670016B
[ ALLOC_GFX ] used: 8536807B | peak: 8536807B | reserved: 8556168B
Project details:
Unity: 2022.3.62f2
Addressables: 1.22.3
Platform: WebGL
Compression: Brotli
Decompression Fallback: Off
Initial Memory Size: 32 MB
Memory Growth Mode: Geometric
Maximum Memory Size: 2048 MB
Geometric Memory Growth Step: 0.2
Geometric Memory Growth Cap: 96 MB
IL2CPP: Fast runtime
.NET Standard: 2.1
Shader variant loading settings:
Default Chunk Size (MB): 16
Default Chunk Count: 0
Addressables:
Bundle sizes:
defaultlocalgroup_assets_all ~3.4 MB
lazyloading_assets_all ~6 MB
unitybuiltinshaders.bundle ~19 MB
Bundle Mode = Pack Together
The ~16 MB allocation size appears repeatedly. We are wondering if this could be related to shader variant loading, bundle decompression, or Addressables dependency deserialization.
Any suggestions would be greatly appreciated.