FormatConverter: do periodic GC

this reduces the risk of OOM during conversion of large worlds
we probably ought to limit the size of region caches for regionized worlds, but that's a problem for another time.
This commit is contained in:
Dylan K. Taylor 2024-12-21 17:47:16 +00:00
parent ada3acdba4
commit 306623e890
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -153,6 +153,9 @@ class FormatConverter{
$this->logger->info("Converted $counter / $count chunks (" . floor($this->chunksPerProgressUpdate / $diff) . " chunks/sec)");
flush();
}
if(($counter % (2 ** 16)) === 0){
$new->doGarbageCollection();
}
}
$total = microtime(true) - $start;
$this->logger->info("Converted $counter / $counter chunks in " . round($total, 3) . " seconds (" . floor($counter / $total) . " chunks/sec)");