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
- Inspector elements are rendered twice when the script component is added via drag-and-drop while the HideFlags.HideInInspector property is set
- Error "Light baking failed with error code 5 (Convergence data not available while rendering lightmaps)" thrown in Console when generating lighting for specific GameObjects
- Copy and Paste options for an Animation Property value are disabled in the Right click contextual menu
- Asset is not found when searching the Label "NewLabel" in Search Window
- "Compute dispatch: missing texture ID..." and "Compute dispatch: missing UAV ID..." warnings are thrown after changing the platform in High Definition 3D template
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.