From e529f2d4d196b83ea8cfcef85030aa687558a01a Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Mon, 10 Jan 2022 22:44:03 -0600 Subject: [PATCH] Revert "- be a bit more aggressive with the GC when not running the game loop." This reverts commit b4d03501aff8b7ff8318f562a00a6ef89adb9eb1. --- src/common/objects/dobject.cpp | 3 --- src/common/objects/dobjgc.cpp | 1 - src/common/objects/dobjgc.h | 10 +--------- src/g_game.cpp | 9 --------- 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/common/objects/dobject.cpp b/src/common/objects/dobject.cpp index 34e2f4cc7b..2ed8279da0 100644 --- a/src/common/objects/dobject.cpp +++ b/src/common/objects/dobject.cpp @@ -229,7 +229,6 @@ DObject::DObject () ObjNext = GC::Root; GCNext = nullptr; GC::Root = this; - GC::AllocCount++; } DObject::DObject (PClass *inClass) @@ -239,7 +238,6 @@ DObject::DObject (PClass *inClass) ObjNext = GC::Root; GCNext = nullptr; GC::Root = this; - GC::AllocCount++; } //========================================================================== @@ -277,7 +275,6 @@ DObject::~DObject () void DObject::Release() { - if (GC::AllocCount > 0) GC::AllocCount--; DObject **probe; // Unlink this object from the GC list. diff --git a/src/common/objects/dobjgc.cpp b/src/common/objects/dobjgc.cpp index fc7acf5f21..f8a5ceb632 100644 --- a/src/common/objects/dobjgc.cpp +++ b/src/common/objects/dobjgc.cpp @@ -116,7 +116,6 @@ namespace GC size_t AllocBytes; size_t Threshold; size_t Estimate; -size_t AllocCount; DObject *Gray; DObject *Root; DObject *SoftRoots; diff --git a/src/common/objects/dobjgc.h b/src/common/objects/dobjgc.h index f48eebcb16..2bca366165 100644 --- a/src/common/objects/dobjgc.h +++ b/src/common/objects/dobjgc.h @@ -43,9 +43,6 @@ namespace GC // Number of bytes currently allocated through M_Malloc/M_Realloc. extern size_t AllocBytes; - // Number of allocated objects since last CheckGC call. - extern size_t AllocCount; - // Amount of memory to allocate before triggering a collection. extern size_t Threshold; @@ -111,16 +108,11 @@ namespace GC } // Check if it's time to collect, and do a collection step if it is. - static inline bool CheckGC() + static inline void CheckGC() { - AllocCount = 0; CheckTime++; if (AllocBytes >= Threshold) - { Step(); - return true; - } - return false; } // Forces a collection to start now. diff --git a/src/g_game.cpp b/src/g_game.cpp index f38a21b3e3..10b4ee4c05 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1316,15 +1316,6 @@ 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 = max(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();