Download

Garbage Collection friendly code

Hello guys,

I posted another thread on the AnswerHub, where my exact problem is stated: My Post
Looks like I found the problem myself though, as the Garbage Collection seems to give me huge hitches. In my game I have fast-firing weapons though, what causes a lot of projectiles to spawn and despawn subsequently. I guess that is not what one would call “Garbage-Collection-friendly”? How can I avoid the huge hitches every 30-60 seconds?
In the UE3 docs/forums I found some posts about turning the GC Verify off to avoid hitches, but I guess there’s a reason for it to be there? Is that even possible anymore in the UE4?
I am thankful for any help! Thanks in advance :slight_smile:

Best regards,
Nanoxin

Hi Nanoxin,

I replied on Answerhub to your question.

Thanks for sharing this Robert!

I added it to my Garbage Collection Wiki:

:heart:

Rama

Necroing thread. Still there is no legit info how to optimize your GC

For short lived, transient objects, of which there are many (such as projectiles or particles) - the usual answer is spawn a fixed number of them and reuse instead of creating/destroying.