Skip to content

Commit

Permalink
Revert "- be a bit more aggressive with the GC when not running the g…
Browse files Browse the repository at this point in the history
…ame loop."

This reverts commit b4d0350.
  • Loading branch information
rheit authored and coelckers committed Jan 11, 2022
1 parent 3154999 commit e529f2d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 22 deletions.
3 changes: 0 additions & 3 deletions src/common/objects/dobject.cpp
Expand Up @@ -229,7 +229,6 @@ DObject::DObject ()
ObjNext = GC::Root;
GCNext = nullptr;
GC::Root = this;
GC::AllocCount++;
}

DObject::DObject (PClass *inClass)
Expand All @@ -239,7 +238,6 @@ DObject::DObject (PClass *inClass)
ObjNext = GC::Root;
GCNext = nullptr;
GC::Root = this;
GC::AllocCount++;
}

//==========================================================================
Expand Down Expand Up @@ -277,7 +275,6 @@ DObject::~DObject ()

void DObject::Release()
{
if (GC::AllocCount > 0) GC::AllocCount--;
DObject **probe;

// Unlink this object from the GC list.
Expand Down
1 change: 0 additions & 1 deletion src/common/objects/dobjgc.cpp
Expand Up @@ -116,7 +116,6 @@ namespace GC
size_t AllocBytes;
size_t Threshold;
size_t Estimate;
size_t AllocCount;
DObject *Gray;
DObject *Root;
DObject *SoftRoots;
Expand Down
10 changes: 1 addition & 9 deletions src/common/objects/dobjgc.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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.
Expand Down
9 changes: 0 additions & 9 deletions src/g_game.cpp
Expand Up @@ -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<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();
Expand Down

0 comments on commit e529f2d

Please sign in to comment.