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

Scripting

-

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

  1. 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.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.