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
- Project Auditor's "Install Rules" button has to be pressed twice to proceed when any compilation error in the Editor is present
- Crash on Scripting::UnityEngine::SubsystemManagerProxy::ClearSubsystems when adding a Mesh Collider Component to a GameObject
- ScrollView clips content when under an ancestor that has a filter set
- "Retrieving array element that was out of bounds" error thrown when attempting to remove a column from a Multi-Column List View
- Multi-Column List View horizontal scroll resets to left most position when scrolling vertically
Resolution Note (fix version 2021.2):
Fixed in 2021.2.0a1