mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
Revert "- be a bit more aggressive with the GC when not running the game loop."
This reverts commit b4d03501af
.
This commit is contained in:
parent
31549997b4
commit
e529f2d4d1
4 changed files with 1 additions and 22 deletions
|
@ -229,7 +229,6 @@ DObject::DObject ()
|
||||||
ObjNext = GC::Root;
|
ObjNext = GC::Root;
|
||||||
GCNext = nullptr;
|
GCNext = nullptr;
|
||||||
GC::Root = this;
|
GC::Root = this;
|
||||||
GC::AllocCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DObject::DObject (PClass *inClass)
|
DObject::DObject (PClass *inClass)
|
||||||
|
@ -239,7 +238,6 @@ DObject::DObject (PClass *inClass)
|
||||||
ObjNext = GC::Root;
|
ObjNext = GC::Root;
|
||||||
GCNext = nullptr;
|
GCNext = nullptr;
|
||||||
GC::Root = this;
|
GC::Root = this;
|
||||||
GC::AllocCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -277,7 +275,6 @@ DObject::~DObject ()
|
||||||
|
|
||||||
void DObject::Release()
|
void DObject::Release()
|
||||||
{
|
{
|
||||||
if (GC::AllocCount > 0) GC::AllocCount--;
|
|
||||||
DObject **probe;
|
DObject **probe;
|
||||||
|
|
||||||
// Unlink this object from the GC list.
|
// Unlink this object from the GC list.
|
||||||
|
|
|
@ -116,7 +116,6 @@ namespace GC
|
||||||
size_t AllocBytes;
|
size_t AllocBytes;
|
||||||
size_t Threshold;
|
size_t Threshold;
|
||||||
size_t Estimate;
|
size_t Estimate;
|
||||||
size_t AllocCount;
|
|
||||||
DObject *Gray;
|
DObject *Gray;
|
||||||
DObject *Root;
|
DObject *Root;
|
||||||
DObject *SoftRoots;
|
DObject *SoftRoots;
|
||||||
|
|
|
@ -43,9 +43,6 @@ namespace GC
|
||||||
// Number of bytes currently allocated through M_Malloc/M_Realloc.
|
// Number of bytes currently allocated through M_Malloc/M_Realloc.
|
||||||
extern size_t AllocBytes;
|
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.
|
// Amount of memory to allocate before triggering a collection.
|
||||||
extern size_t Threshold;
|
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.
|
// 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++;
|
CheckTime++;
|
||||||
if (AllocBytes >= Threshold)
|
if (AllocBytes >= Threshold)
|
||||||
{
|
|
||||||
Step();
|
Step();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forces a collection to start now.
|
// Forces a collection to start now.
|
||||||
|
|
|
@ -1316,15 +1316,6 @@ void G_Ticker ()
|
||||||
default:
|
default:
|
||||||
break;
|
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
|
// [MK] Additional ticker for UI events right after all others
|
||||||
primaryLevel->localEventManager->PostUiTick();
|
primaryLevel->localEventManager->PostUiTick();
|
||||||
|
|
Loading…
Reference in a new issue