Search Issue Tracker
By Design
Votes
0
Found in
2019.1
2019.3.9f1
2019.4
2020.1
2020.2
Issue ID
1253593
Regression
Yes
Crash on GC_malloc_kind_global when entering Play Mode and using pointers in script
How to reproduce:
1. Open attached project "Case_1253593_pointers.rar"
2. Enter Play Mode
Expected result: Editor does not crash
Actual result: Editor crashes
Reproducible with - 2019.1.0f1, 2019.1.14f1, 2019.4.2f1, 2020.1.0b14, 2020.2.0a16
Not reproducible with - 2017.4.40f1, 2018.4.23f1, 2019.1.0b10
Notes:
Does not crash 100% of the times
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
- Editor crashes on D3D12GetInterface when repeatedly enabling and disabling 256 text components
- Flickering bright white dots in the Scene when the Android Platform is selected and DX11 Graphics API is used with Iris(R) Xe Graphics GPU
- Inconsistent capitalization and misaligned text in multiple query blocks in Search window
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
Resolution Note:
The issue here is that pointers to array elements are stored and accessed outside of a `fixed` block. The memory may be moved or collected. In this case, the fix is to allocate a pinned GC handle to keep the array alive and fixed. Something like this
System.Runtime.InteropServices.GCHandle.Alloc(c, System.Runtime.InteropServices.GCHandleType.Pinned);