Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.35f1

2022.3.19f1

2023.2.10f1

2023.3.0b7

Issue ID

UUM-63391

Regression

No

Crash on GC_mark_from when compiling a script with an array that contains ~81K string elements

--

-

Reproduction steps:
1. Open the attached “ReproProj” project

Expected result: The project opens
Actual result: The Editor crashes

Reproducible with: 2021.3.35f1, 2022.3.19f1, 2023.2.10f1, 2023.3.0b7

Reproducible on: macOS 14.2.1 (M1 Max)
Not reproducible on: No other environment tested

First lines of the stack trace:
#0 0x0000014f32d118 in GC_mark_from
#1 0x0000014f327d74 in GC_mark_some
#2 0x0000014f327aa8 in GC_collect_a_little_inner
#3 0x0000014f335828 in GC_wait_for_gc_completion
#4 0x0000014f335c34 in GC_unregister_my_thread
#5 0x0000014f2b27e4 in thread_detach
#6 0x0000014f30db38 in unregister_thread
#7 0x0000014f30f430 in mono_thread_info_exit

  1. Resolution Note:

    Thank you for reporting a bug to Unity. This crash is due to a stack overflow caused by the array initialization compiling down to a large method using a large amount of stack space. The array initialization is not a constant operation, but repeated (81k in this case) string creations and stores into the array.

    The best workaround for this case would be to load the string contents from a text file/resource, and initialize the array in a loop using the contents of the file.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.