Search Issue Tracker
Won't Fix
Won't Fix in 1.0.X
Votes
1
Found in [Package]
1.0.0
Issue ID
ECSB-246
Regression
No
Unity Crashes on MemoryProfiler::UnregisterAllocation when instantiating a new Entity
How to reproduce:
1. Open the "dots_crash" project
2. Open the "SampleScene"
3. Make sure that the “New Sub Scene” Scene is set as “Open for editing” (Hierarchy > “New Sub Scene” > Check the box in Hierarchy)
4. Enter Play Mode
5. While facing the ground, choose any block, remove it, and place it back
6. Remove and place back the block again
7. Finally, place a new block on top of the replaced block
Expected result: blocks get placed and removed from the scene
Actual result: Unity crashes
Reproduced with: 0.17.0-preview.41 (2022.2.13f1), 1.0.0-exp.12 (2022.2.13f1, 2023.1.0b10, 2023.2.0a8)
Could not test with: 0.17.0-preview.41 (2020.3.46f1) (Entities Graphics package is not supported), 1.0.0-pre.65 (2022.2.13f1) (Could not resolve scripting errors)
Reproduced on: Windows 10 (by reporter), Windows 11
Stack Trace:
0x00007ff726c4f3bb (Unity) MemoryProfiler::UnregisterAllocation
0x00007ff7268842b6 (Unity) MemoryManager::Deallocate
0x00007ff72688cc6a (Unity) free_alloc_internal
0x00007ff726167687 (Unity) UnsafeUtility::Free
0x00007ff725fad1ce (Unity) UnsafeUtility_CUSTOM_Free
Notes:
1. Blocks can be removed with Left Mouse Click; Blocks can be placed with Right Mouse Click
2. It can happen very rarely, but after reproduction steps, the Unity Editor hangs, then silently crashes
3. Also reproduced in Player
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
- [Dragon Crashers] Build fails in U6
- [Dragon Crashers] 4 Shader error messages on import
- [Dragon Crashers] Readme text is white on light grey
- Cursor stays in front of the first character when entering text in the TextMeshPro field
- Searching in Hierarchy causes unwanted component calls
Resolution Note:
There are no fixes planned for this Bug
Resolution Note (1.0.X):
The error is caused by passing a null entity to EntityCommandBuffer.DestroyEntity(). A new check was recently added to the Entities package which tests for this condition when the DestroyEntity command is recorded, rather than at playback time.
The easiest way to avoid the crash would be to add a guard before calling DestroyEntity() in AddBlockSystem:
if (f1 != Entity.Null) // <---- add this check to avoid the error
ecb.DestroyEntity(f1);
With this change, the issue no longer reproduces in the original project.