Allocator.Persistent crash in non-dev build 2019.2.0a13

This code crashes in a non-dev build but only with the Persistent allocator. It works if you use Temp or TempJob.

int* data = (int*) UnsafeUtility.Malloc(sizeof(int)*4, UnsafeUtility.AlignOf<int>(), Allocator.Persistent);

My game was crashing immediately after the Unity logo and I tracked it down to the first Persistent allocation of the NativeMultiHashMap s_StableTypeHashToTypeIndex in TypeManager.InitialiseAllComponents() when ecs bootstraps.

If I disable ecs via UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP, then I can crash it with nothing but the code above in a completely new empty project.
I'm building with mono and it crashes in Windows, Linux and Android. Doesn't crash in the Editor or in dev builds. Discovered it in 2019.2.0a11 but it still exists in 0a13.
It doesn't crash in 2019.1.0b10 which is the last version of 2019.1 I've got installed.

Could you please submit a bug report with a minimal reproduction project for this issue and reply in here with the issue ID?

#1149495

1 Like

Thanks a lot for the report! We were able to reproduce the issue and the devs will look into it. You can check the latest state of the resolution process here: https://issuetracker.unity3d.com/product/unity/issues/guid/1149495/