SanAndreasUnity icon indicating copy to clipboard operation
SanAndreasUnity copied to clipboard

Reduce GC allocations

Open in0finite opened this issue 4 years ago • 0 comments

GC causes a lot of freezes in the mobile version.

Here are the screenshots of profiler showing what is allocating the memory (at commit 7725dfb):

Complete list complete list imGUI details GUI details behaviour update details behaviour update details


As of version 3.2, GC is freezing the Android game on every 10 seconds, when running at 17 FPS in Demo scene.

As we can see, 7.9 KB out of 11.7 KB (67 %) is taken by imGUI. By converting imGUI to uGUI (see #52 for in-game UI) and using a single OnGUI() function, we can reduce 7.9 KB to only 0.4 KB.

This should be profiled again because #52 is done.

After #106 is done, there will be only a few usages of imGUI, so the most of GC allocations will be done by game logic. Also, this ticket will probably not be important anymore, so it can be closed at that moment.

in0finite avatar Oct 06 '19 17:10 in0finite