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
- Rigidbody2D.Slide API does not have the needed configuration when creating a 2D Top-Down character controller
- Opening reference for "Playables"component redirects to a missing page
- Sprite Renderer image is changed when switching Mask Interaction and changing Sprite to a shared Sprite
- An unsigned integer is not compared with an integer correctly in player when using IL2CPP backend
- Graphical artifacts are being rendered in Scenes that are loaded during run-time when GPU Resident Drawer is turned on
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);