1
\$\begingroup\$

I'm making a 2D game for mobile and I noticed that my GC seemed to spike during attack. My normal GC is 40b but during attack it could spike to 2.2kb. I think this is really high specially when I saw a 3D game with only 8b GC. I would love to hear your thoughts about what's a reasonable amount of GC for mobile(e.g device with 512ram). I know I'm supposed to keep the GC as low as possible however I want to have a value I could compare to.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ As little as possible. Memory fragmentation will eventually become a problem if you do a lot. But don't worry about it unless your profiler tells you there's a problem. \$\endgroup\$ – Almo Mar 27 '18 at 18:49
2
\$\begingroup\$

There's no real rule on what's reasonable. If your game performs ok, then don't worry about it. If you're having problems and you're sure it's GC, then consider pooling objects. Also check this article:

https://unity3d.com/learn/tutorials/topics/performance-optimization/optimizing-garbage-collection-unity-games

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.