Trying to allocate: 18446744056529682440B with 16 alignment. MemoryLabel: TempOverflow

During the use of my Unity application, a crash occurred. After inspecting the logs, I found that Unity was attempting to allocate a ridiculously large amount of memory, which resulted in the crash. I tried to replicate the issue using the user’s method but was not successful in reproducing it. My Unity version is 2022.3.8f1c1.

I’ve been troubled by this issue for almost a week and hope someone can help me.
The error log is as follows:

Could not allocate memory: System out of memory!
Trying to allocate: 18446744056529682440B with 16 alignment. MemoryLabel: TempOverflow
Allocation happened at: Line:69 in C:\jenkins\sharedspace\ra_2022.3\Runtime\Utilities\dynamic_array.h
Memory overview

[ ALLOC_TEMP_TLS ] used: 21912B | peak: 0B | reserved: 9633792B
[ ALLOC_MEMORYPROFILER ] used: 809680B | peak: 809680B | reserved: 1048576B
[ ALLOC_DEFAULT ] used: 158411296B | peak: 0B | reserved: 170221568B
[ 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: 599914B | peak: 0B | reserved: 4194304B
[ ALLOC_TEMP_JOB_ASYNC (Background) ] used: 237B | peak: 0B | reserved: 6291456B
[ ALLOC_GFX ] used: 9834152B | peak: 0B | reserved: 33554432B
[ ALLOC_CACHEOBJECTS ] used: 40457036B | peak: 0B | reserved: 46063616B
[ ALLOC_TYPETREE ] used: 12928B | peak: 0B | reserved: 4194304B
[ ALLOC_PROFILER ] used: 445640B | peak: 34932280B | reserved: 50331648B
Could not allocate memory: System out of memory!
Trying to allocate: 18446744056529682440B with 16 alignment. MemoryLabel: TempOverflow
Allocation happened at: Line:69 in C:\jenkins\sharedspace\ra_2022.3\Runtime\Utilities\dynamic_array.h
Memory overview

[ ALLOC_TEMP_TLS ] used: 21912B | peak: 0B | reserved: 9633792B
[ ALLOC_MEMORYPROFILER ] used: 809680B | peak: 809680B | reserved: 1048576B
[ ALLOC_DEFAULT ] used: 158411296B | peak: 0B | reserved: 170221568B
[ 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: 599914B | peak: 0B | reserved: 4194304B
[ ALLOC_TEMP_JOB_ASYNC (Background) ] used: 237B | peak: 0B | reserved: 6291456B
[ ALLOC_GFX ] used: 9834152B | peak: 0B | reserved: 33554432B
[ ALLOC_CACHEOBJECTS ] used: 40457036B | peak: 0B | reserved: 46063616B
[ ALLOC_TYPETREE ] used: 12928B | peak: 0B | reserved: 4194304B
[ ALLOC_PROFILER ] used: 445640B | peak: 34932280B | reserved: 50331648B

The stack trace information at the time of the crash is as follows:
========== OUTPUTTING STACK TRACE ==================

0x00007FF8FCD25B93 (UnityPlayer) DebugStringToFilePostprocessedStacktrace
0x00007FF8FCD2538E (UnityPlayer) DebugStringToFile
0x00007FF8FB571717 (UnityPlayer) MemoryManager::Allocate
0x00007FF8FB5712BE (UnityPlayer) MemoryManager::Allocate
0x00007FF8FB5712BE (UnityPlayer) MemoryManager::Allocate
0x00007FF8FB57A020 (UnityPlayer) malloc_internal
0x00007FF8FBE82D06 (UnityPlayer) dynamic_array_detail::dynamic_array_data::reserve
0x00007FF8FC86873C (UnityPlayer) UI:: DepthSortGrid::AddAndGetDepthFor
0x00007FF8FC86AF68 (UnityPlayer) UI:: PrepareDepthEntries
0x00007FF8FC86BC6C (UnityPlayer) UI::SortForBatching
0x00007FF8FC86BF7E (UnityPlayer) UI::SortForBatchingJob
0x00007FF8FBA96967 (UnityPlayer) ujob_execute_job
0x00007FF8FBA960E4 (UnityPlayer) lane_guts
0x00007FF8FBA987E4 (UnityPlayer) worker_thread_routine
0x00007FF8FBF0BE97 (UnityPlayer) Thread::RunThreadWrapper
0x00007FF93DCE7344 (KERNEL32) BaseThreadInitThunk
0x00007FF93F7026B1 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

Does this crash occur frequently, or only once?

The issue only happens for one user? If so, I’d ignore it for now. For all you know, that user’s system may simply be unstable. I’d check the start of the log for system details, perhaps the machine isn’t up to specs or drivers being outdated or not certified.

So far there has only been one incident, but we are very confused about this crash. We don’t know if it’s a mistake in our code or a bug in Unity itself.

And the computer’s system seems to be running normally:

Found 2 interfaces on host : 0) 192.168.1.135 1) 192.168.42.105
Multi-casting “[IP] 192.168.1.135 [Port] 55000 [Flags] 2 [Guid] 1779781528 [EditorId] 3185506860 [Version] 1048832 [Id] WindowsPlayer(2,C3-B1)
[Debug] 0 [PackageName] WindowsPlayer [ProjectName] UniGame” to [225.0.0.222:54997]…
[Physics::Module] Initialized MultithreadedJobDispatcher with 11 workers.
Initialize engine version: 2022.3.8f1c1 (4ec8ee1b2212)

GfxDevice: creating device client; threaded=1; jobified=0
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce RTX 3050 Laptop GPU (ID=0x25e2)
Vendor: NVIDIA
VRAM: 3977 MB
Driver: 31.0.15.2892
Initializing input.

XInput1_3.dll not found. Trying XInput9_1_0.dll instead…
Input initialized.

Initialized touch support.