- took VMFunction out of the DObject hierarchy.

As it stood, just compiling the internal ZScript code created more than 9000 DObjects, none of which really need to be subjected to garbage collection, aside from allowing lazy deallocation.
This puts an incredible drag on the garbage collector which often needs several minutes to finish processing before actual deletion can start.

The VM functions with roughly 1800 of these objects were by far the easiest to refactor so they are now. They also use a memory arena now which significantly reduces their memory footprint.
This commit is contained in:
Christoph Oelckers 2017-02-08 11:13:41 +01:00
commit 3cbd62479b
8 changed files with 59 additions and 73 deletions

View file

@ -361,17 +361,6 @@ static void MarkRoot()
}
Mark(SectorMarker);
Mark(interpolator.Head);
// Mark action functions
if (!FinalGC)
{
FAutoSegIterator probe(ARegHead, ARegTail);
while (*++probe != NULL)
{
AFuncDesc *afunc = (AFuncDesc *)*probe;
Mark(*(afunc->VMPointer));
}
}
// Mark types
TypeTable.Mark();
for (unsigned int i = 0; i < PClass::AllClasses.Size(); ++i)
@ -776,7 +765,7 @@ CCMD(gc)
{
if (argv.argc() == 1)
{
Printf ("Usage: gc stop|now|full|pause [size]|stepmul [size]\n");
Printf ("Usage: gc stop|now|full|count|pause [size]|stepmul [size]\n");
return;
}
if (stricmp(argv[1], "stop") == 0)
@ -791,6 +780,12 @@ CCMD(gc)
{
GC::FullGC();
}
else if (stricmp(argv[1], "count") == 0)
{
int cnt = 0;
for (DObject *obj = GC::Root; obj; obj = obj->ObjNext, cnt++)
Printf("%d active objects counted\n", cnt);
}
else if (stricmp(argv[1], "pause") == 0)
{
if (argv.argc() == 2)
@ -814,3 +809,4 @@ CCMD(gc)
}
}
}