- be a bit more aggressive with the GC when not running the game loop.

Since most CheckGC calls are within the main game ticker, the engine can accumulate a lot of data when creating/deleting objects in the menu or other UI parts and never manage to collect everything
This commit is contained in:
Christoph Oelckers 2021-10-03 14:01:27 +02:00
commit b4d03501af
4 changed files with 22 additions and 1 deletions

View file

@ -1316,6 +1316,15 @@ void G_Ticker ()
default:
break;
}
// Do some more aggressive GC maintenance when the game ticker is inactive.
if ((gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL) || paused || P_CheckTickerPaused())
{
size_t ac = std::max<size_t>(10, GC::AllocCount);
for (size_t i = 0; i < ac; i++)
{
if (!GC::CheckGC()) break;
}
}
// [MK] Additional ticker for UI events right after all others
primaryLevel->localEventManager->PostUiTick();