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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
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);