Glorious Battle is crashing after 9 minutes of gameplay

My game is crashing after 9 minutes of gameplay.

It’s weird how just 9 minutes all the time.

make sure that you don’t have memory leaks in your game you should check the scripts activity rate


idk what this means

but this is after 10 minutes of gameplay

image
game is crazy tho

1 Like

probably a memory leak or too many npcs lagging by using path finding

You might have a memory leak, which is where your code endlessly uses more memory until the computer runs out and crashes. This can be either on the client or the server (from your screenshot below it doesn’t look like it’s happening on the client).

It’s also possible that your code could be causing a fatal error like a stack overflow, which is where your code doesn’t stop running (e.g. a while loop without an end condition or wait/yield).

Some questions:

  • Does it always happen at exactly 9 mins? If so, perhaps some of your code runs at 9 mins that crashes it?
  • Does it happen in studio? If so, does it print an error or does studio crash too? If it prints an error, what is the error? (You can check errors in the output, which you can get to from ribbon bar → view → output button.)

It doesn’t print an error.

I reviewed all my loops and they all have safety checks in place to exit.

Sometimes randomly the server will freeze completely and after 20 seconds i get a “Kicked” message

There is no pathfinding in my game. The NPCs also sort the troops by nearest and they cache the results. So every 30 seconds the list of enemies is sorted again. This is more efficient and provides a better effect. After 30 seconds the cache is cleared.

Does it happen in studio?

You can see how to view server memory here: