- fixed GC::FullGC not collecting everything anymore.

With the delayed handling of internal references of destroyed objects the function now returned without making sure that it really got everything.
Repeating until it cannot delete anything new anymore makes it work again as intended.
This commit is contained in:
Christoph Oelckers 2022-12-05 12:29:03 +01:00
parent 2ed8e6780e
commit aedf0e3ce5

View file

@ -550,28 +550,34 @@ void Step()
void FullGC()
{
if (State <= GCS_Propagate)
bool ContinueCheck = true;
while (ContinueCheck)
{
// Reset sweep mark to sweep all elements (returning them to white)
SweepPos = &Root;
// Reset other collector lists
Gray = nullptr;
State = GCS_Sweep;
}
// Finish any pending GC stages
while (State != GCS_Pause)
{
SingleStep();
}
// Loop until everything that can be destroyed and freed is
do
{
MarkRoot();
ContinueCheck = false;
if (State <= GCS_Propagate)
{
// Reset sweep mark to sweep all elements (returning them to white)
SweepPos = &Root;
// Reset other collector lists
Gray = nullptr;
State = GCS_Sweep;
}
// Finish any pending GC stages
while (State != GCS_Pause)
{
SingleStep();
}
} while (HadToDestroy);
// Loop until everything that can be destroyed and freed is
do
{
MarkRoot();
while (State != GCS_Pause)
{
SingleStep();
}
ContinueCheck |= HadToDestroy;
} while (HadToDestroy);
}
}
//==========================================================================