Search Issue Tracker
By Design
Votes
0
Found in
2018.1.0f2
Issue ID
1044061
Regression
No
Itterating through a list with foreach always generating GCAlloc
Steps to reproduce:
1. Download and open the attached project
2. Enter Playmode
3. Press "4"(not numpad) to initiate iteration
Expected result: no GCAlloc
Actual result: 63 bytes of GCAlloc on every iteration
Reproduced on 2017.4f1, 2018.1.3f1, 2018.2.0b6, 5.5.6f1*
*this was allegedly fixed in 5.5 - https://unity3d.com/learn/tutorials/topics/performance-optimization/optimizing-garbage-collection-unity-games
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note:
All allocations related to collection iteration (for properly designed collections) have been alleviated by use of newer C# compilers. This allocation reported here is actually an internal Type object allocated by the runtime when the first method of a type being JIT'd. It only happens once and is not specifically related to the collection iteration.