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
- [UWP] Mouse movement re-triggers stale <Mouse>/scroll value after the scroll wheel is used once
- "Shutdown worker was forced killed because it kept running. Worker ..." errors are thrown after building a blank HDRP project
- [UI Toolkit] USS materials in AssetBundles break due to InstanceID referencing a material that no longer exists when a Scene is loaded through Addressables for the second time
- Help button leads to a missing documentation page when clicked on a Font Import Settings in the Inspector
- TextMeshPro Text Component reads bottom-to-top instead of top-to-bottom when using RTL Editor
Resolution Note (fix version 2021.2):
Fixed in 2021.2.0a1