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
- [HDRP] Recursive rendering refraction is very different compared to Rasterization/PathTracing
- [VFX] SMR sampling first frame after culling in T-Pose
- Can't select color from Editor with color picker when Unity Editor is on Secondary monitor
- [Linux] "Error while reading movie" errors in Learning templates due to unsupported .mov video format
- [Android] Crash with Signal 11 when opening app from floating icon state
Resolution Note (fix version 2021.2):
Fixed in 2021.2.0a1