Search Issue Tracker
Fixed in 2021.2.X
Votes
1
Found in
2019.4
2019.4.5f1
2021.1
Issue ID
1276456
Regression
No
Additional memory allocated when removing WorkRequest in UnitySynchronizationContext.cs
How to reproduce:
1. Open the included project "AsyncTest_Repro.zip"
2. In Build Settings enable: Development Build, Autoconnect Profiler and Deep Profiling Support
3. Build and run the project
4. Click the button "Start Await_VoidReturn" several times
5. In the profiler observe how UnitySynchronizationContext.Exec() -> List'1.Remove() allocates memory (video attached "HowToReproduce.mp4")
Actual result: List'1.Remove() calls List'1.IndexOf() which allocates additional memory
Expected result: List'1.RemoveAt(0) could be used instead, as it does not allocate additional memory
Reproducible with: 2019.4.28f1, 2020.1.6f1, 2020.2.0b8, 2021.1.0a1
Not reproducible with: 2018.4.28f1 (This stream does not have m_CurrentFrameWork.Remove(work) in UnitySynchronizationContext.cs implemented, see case 1213602)
Notes:
- Link to affected code: https://github.com/Unity-Technologies/UnityCsReference/blob/master/Runtime/Export/Scripting/UnitySynchronizationContext.cs
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
- UI Overlay Image gets darker on each Camera when multiple Cameras are used
- Assertion failed on expression: 'scriptedImporterClass == SCRIPTING_NULL error when opening the standalone profiler window
- Disabled assets in Import Unity Package window aren't tracked but count as being selected by user
- [Windows] Crash on GetManagerFromContext when video is playing and creating High Definition 3D Projects after FMOD failed to switch back to normal output Error appeared
- GC Alloc produced when adding items to MultiColumnListView with Auto Assign Binding
Resolution Note (fix version 2021.2):
Fixed in 2021.2.0a1