1
0
forked from 0ad/0ad

Fix performance drop and memory leak on networked AI matches.

When playing a network game with at least one AI, and an AI dies, after
a while there will be an increasing lag on the system, eventually
freezing the screen for e.g. 4 seconds every 5 seconds.
It turned out that once the AI is dead, the savedEvents grew endlessly.
Causing issues down the line (hashing).

That is now fixed by discarding savedEvents when the AI is defeated.

Patch by: @lairkers
Differential revision: https://code.wildfiregames.com/D5042
Comments by: @phosit, @wraitii
This was SVN commit r27800.
This commit is contained in:
Freagarach 2023-08-16 09:48:24 +00:00
parent 5ba7ec3bfa
commit 48de9e32f0
2 changed files with 2 additions and 1 deletions

View File

@ -160,6 +160,7 @@
{ "nick": "Krinkle", "name": "Timo Tijhof" },
{ "nick": "Kuba386", "name": "Jakub Kośmicki" },
{ "nick": "lafferjm", "name": "Justin Lafferty" },
{ "nick": "lairkers" },
{ "nick": "Langbart" },
{ "nick": "LeanderH", "name": "Leander Hemelhof" },
{ "nick": "leper", "name": "Georg Kilzer" },

View File

@ -88,7 +88,7 @@ PETRA.PetraBot.prototype.CustomInit = function(gameState)
PETRA.PetraBot.prototype.OnUpdate = function(sharedScript)
{
if (this.gameFinished)
if (this.gameFinished || this.gameState.playerData.state == "defeated")
return;
for (let i in this.events)