Even when free() can be called with a null pointer, the extra call might
be significant. On hard GC benchmarks making the test for null in the GC
code (i.e. avoiding the free() call) can reduce the GC time by almost ~5%.
void Dtor()
{
+ // Even when free() can be called with a null pointer, the extra call
+ // might be significant. On hard GC benchmarks making the test for null
+ // here (i.e. not making the call) can reduce the GC time by almost
+ // ~5%.
if (data)
{
cstdlib.free(data);
pool.Dtor();
cstdlib.free(pool);
}
+
+ // Even when free() can be called with a null pointer, the extra call
+ // might be significant. On hard GC benchmarks making the test for null
+ // here (i.e. not making the call) can reduce the GC time by almost
+ // ~5%.
if (pooltable)
cstdlib.free(pooltable);
-
if (roots)
cstdlib.free(roots);
-
if (ranges)
cstdlib.free(ranges);
}
baseAddr = null;
topAddr = null;
}
+ // See Gcx.Dtor() for the rationale of the null check.
if (pagetable)
cstdlib.free(pagetable);