x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Game Hitches (GC Mark Time?)

Hello guys,

I have a somehwat important problem, as in my game, there are quite a lot of projectiles (for a mobile game at least) and after some time (like 30-40 seconds ca.) there is a huge lag. When tracking with the STAT XXXXX commands the GC Mark Time seems to be responsible for this, it suddenly takes a huge amount of time, then goes back to 0. Will this be like this in released, final state as well? What can I do to fix this? Did I do something wrong with destroying my projectiles? (Actually they get destroyed by the end of their lifespan, so that shouldn't be it, right? And in the other cases I simply use Destroy() ...)

I'd be glad about any ideas :)

Regards, Nano

PS: My editor keeps stacking up "Deleted Actor"s in the actor list on the top right corner as well and that number just gets bigger and bigger when I shoot but barely decrements...

PS2: This issue happens on PC and on Android, in the Editor and when launched to the phone :(

EDIT: I checked with the profiler, it is indeed the GC Mark Time, taking a maximum of 1200ms at once!

Product Version: Not Selected
Tags:
more ▼

asked Feb 25 '15 at 10:00 AM in Using UE4

avatar image

Nanoxin
301 35 36 44

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Nanoxin, you are probably right that it's the GC running, and this is somewhat normal in Development build. To verify your performance, there is a command line that is helpful that should remove that lag : -NoVerifyGC From the documentation:

-NoVerifyGC Otherwise expect massive hitching in Release builds at least every 30 seconds or so.

This should not be present in Shipping build.

Here is the link to the documentation :

https://docs.unrealengine.com/latest/INT/Engine/Performance/Options/index.html

Hope this helps!

Mick

more ▼

answered Feb 25 '15 at 01:35 PM

avatar image

MickD777
2k 69 34 256

avatar image Nanoxin Feb 25 '15 at 09:10 PM

Thanks, wasn't sure about this. Is there any reason NOT to use that command? Or: What do I miss when turning it off? Why is it on by default?

avatar image robert.manuszewski STAFF Mar 04 '15 at 10:44 AM

You can also, try adding:

 [Core.System]
 MaxObjectsNotConsideredByGC=5000
 SizeOfPermanentObjectPool=1048576

In your DefaultEngine.ini file. These numbers are rather random but you can get the correct values from you cooked game log output, just look for something like this:

         [2015.03.04-10.00.21:716][  0]LogObj: 38723 objects as part of root set at end of initial load.
         [2015.03.04-10.00.21:716][  0]LogUObjectAllocator: 9779464 out of 0 bytes used by permanent object pool.


And put whatever the first number is (38723 in this case) in MaxObjectsNotConsideredByGC and the second one (9779464) in SizeOfPermanentObjectPool.

This will help reduce the number of objects GC has to go through when checking for objects to collect.

Also, consider using pool of pre-allocated objects for objects you spawn often. It should work well for projectiles which would get added to world from pool, and return to pool after they've been destroyed.

avatar image Nanoxin Mar 04 '15 at 11:43 PM

Thanks for the idea,

however, I haven't used anything like that object pool yet, is there any engine feature for that? Or would I just have to initialize (spawn?) let's say 100 projectiles at the start of the game and then instead of spawning them on fire, I'd take them from the Pool and place them in the world and instead of destroying put them back into the "pool"? Would that be your suggested workflow or did I misinterpret something here?

Thanks for your help!

avatar image Omberone Apr 27 '15 at 11:59 AM

I believe it already does that for you. Here's a link to a question I posed some time ago: https://answers.unrealengine.com/questions/125888/should-i-create-a-pool-manager.html

avatar image AXE Aug 09 '16 at 02:42 PM

Hey guys, sorry to revive an old thread, but I'm having this same issue: the game has a lot of hitches due to the Garbage Collector. I've tried both the suggestions (-NoVerifyGC when launching the shipping build and setting MaxObjectsNotConsideredByGC and SizeOfPermanentObjectPool in DefaultEngine.ini), but I'm still experiencing hiccups.

I'm not creating/destroying a lot of objects at runtime, nor do I have a lot of objects/entities; this even happens in semi-empty levels with just the player and a couple of AIs.

I could live with it (for now), but I have to showcase a demo of our game in a few days and I could really use some help to fix this, or at least reduce the problem somehow.

The major problem is that when the hiccups happen, the game freezes for a very short time period (less than 1 second), and when it comes back to regular speed, it's like the player Pawn and the AIs all accumulated velocity, so they get pushed away all over the game level.

Thanks!

avatar image hougant Dec 02 '15 at 03:23 AM

as a follow up question, is there a reason the engine couldn't just read the number and set that as MaxObjectsNotConsideredByGC/SizeOfPermanentObjectPool on it's own during load? it's cumbersome when number of objects in root set changes frequently

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question