TActorIterator Efficiency


I am using the QA version of 4.4.

I noticed that over time my game would slow down, leaving it on over night would bring me to 2-3 frames per second, so I investigated why. I found that having TActorIterator in the tick functions of pawns was causing the slow down over time, and when I fixed these to be more efficient to not use TActorIterator the slow down problem disappeared.

What confuses me is that when I started the game, there was 50 actors in the scene, at some point that drops down to 49 actors, and after leaving the game overnight it would still be at 49 actors in the scene. If the number of actors stay they same, why would usiing a type-casted TActorIterator to find certain types of pawns slow down so much over time?

Hi, there was an issue where actor iterators would keep adding redundant callbacks that would never get freed, essentially creating a memory leak. The change was fixed in this commit on github.

Let us know if this doesn’t solve the problem!