Search Issue Tracker


Fixed in 2022.3.8f1, 2023.1.10f1, 7000.0.0a1



Found in


Issue ID




IL2CPP Player crashes when there aren't enough Thread Static Slots



There are currently no reproduction steps

Reproducible with: 2022.2.12f1

Reproducible on: Windows 10

*Original report:*
1. What happened:
I've been debugging a crash issue for our game that occurs on IL2CPP on Windows and to cut a long winding road short I've discovered that the solution to the problem is to double the size of `kMaxThreadStaticSlots` in `Thread.cpp` from 2048 to 4096. This seems to allow our game to successfully run.

2. How can we reproduce it using the example you attached:
I spoke to Joshua Peterson and he requested I submit a bug report. The project is too big to submit here. Contact us if you require the project to repro, but it is an accepted short-coming if not a bug.

Joshua Peterson wrote:
Thanks for raising this issue! The problem here is that the libil2cpp runtime can hold thread static data for a limited number of types, currently 2048. So far this is the first case we know of where this limitation is a problem. We certainly could look to grow that limitation as necessary, but that comes with some performance costs (hence the hard-coded limitation).
I'm curious about the conditions under which this happens in your case. You mentioned full generic sharing in the subject of this message, does that setting impact this problem?
Regarding a solution, you can locally modify the code to increase this value to 4096. The result will be an increase in memory usage, but that will only be the additional 2048 entries times the size of a pointer, so 2048 * 8 bytes on 64-bit architectures. You can make this change in the code that ships with the Unity editor. Is that something you can scale across your developers, so they all have access to it, at least temporarily?
Longer term, we need to either increase this limit or come up with a solution to grow it that has good performance characteristics. For this, can you submit a bug report? That will be the best way for us to track the issue and provide feedback to you about it.

Comments (2)

  1. agboephraim20

    Mar 29, 2023 02:18

    Heavily gifted Ghanaian rapper and singer Jay Bahd, unveils a brand new single on named "Yaa Baby". Jay Bahd’s new delivery serves as a sequel to his previous delivery named "Anadwo"

  2. agboephraim20

    Mar 29, 2023 02:16

    Please anybody has a fix to this?

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.