Anvil garbage collector won't run if not needed

This commit is contained in:
Shoghi Cervantes 2014-04-10 06:02:33 +02:00
parent a1a1f1b8e4
commit f23a05d42e

View File

@ -58,6 +58,7 @@ class RegionLoader{
private function cleanGarbage(){
$sectors = array();
$maxSector = 1;
foreach($this->locationTable as $index => $data){ //Calculate file usage
if($data[0] === 0 or $data[1] === 0){
$this->locationTable[$index] = array(0, 0);
@ -65,9 +66,16 @@ class RegionLoader{
}
for($i = 0; $i < $data[1]; ++$i){
$sectors[$data[0]] = $index;
if($data[0] > $maxSector){
$maxSector = $data[0];
}
}
}
if(count($sectors) === ($maxSector - 2)){ //No collection needed
return 0;
}
ksort($sectors);
$shift = 0;
$lastSector = 1; //First chunk - 1