mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
Moved chunk garbage collector to memory manager
This commit is contained in:
parent
05385acb36
commit
bf4a8398c4
@ -48,6 +48,7 @@ class MemoryManager{
|
||||
private $garbageCollectionAsync;
|
||||
|
||||
private $chunkLimit;
|
||||
private $chunkCollect;
|
||||
private $chunkTrigger;
|
||||
|
||||
private $chunkCache;
|
||||
@ -71,6 +72,7 @@ class MemoryManager{
|
||||
$this->garbageCollectionAsync = (bool) $this->server->getProperty("memory.garbage-collection.collect-async-worker", true);
|
||||
|
||||
$this->chunkLimit = (int) $this->server->getProperty("memory.max-chunks.trigger-limit", 12000);
|
||||
$this->chunkCollect = (bool) $this->server->getProperty("memory.max-chunks.trigger-chunk-collect", true);
|
||||
$this->chunkTrigger = (bool) $this->server->getProperty("memory.max-chunks.low-memory-trigger", true);
|
||||
|
||||
$this->chunkCache = (bool) $this->server->getProperty("memory.world-caches.disable-chunk-cache", true);
|
||||
@ -100,6 +102,12 @@ class MemoryManager{
|
||||
}
|
||||
}
|
||||
|
||||
if($this->chunkTrigger and $this->chunkCollect){
|
||||
foreach($this->server->getLevels() as $level){
|
||||
$level->doChunkGarbageCollection();
|
||||
}
|
||||
}
|
||||
|
||||
$ev = new LowMemoryEvent($memory, $limit, $global, $triggerCount);
|
||||
$this->server->getPluginManager()->callEvent($ev);
|
||||
|
||||
|
@ -1707,10 +1707,6 @@ class Server{
|
||||
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "doAutoSave"]), $this->getProperty("ticks-per.autosave", 6000), $this->getProperty("ticks-per.autosave", 6000));
|
||||
}
|
||||
|
||||
if($this->getProperty("chunk-gc.period-in-ticks", 600) > 0){
|
||||
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "doLevelGC"]), $this->getProperty("chunk-gc.period-in-ticks", 600), $this->getProperty("chunk-gc.period-in-ticks", 600));
|
||||
}
|
||||
|
||||
$this->enablePlugins(PluginLoadOrder::POSTWORLD);
|
||||
|
||||
$this->start();
|
||||
@ -2223,12 +2219,6 @@ class Server{
|
||||
}
|
||||
}
|
||||
|
||||
public function doLevelGC(){
|
||||
foreach($this->getLevels() as $level){
|
||||
$level->doChunkGarbageCollection();
|
||||
}
|
||||
}
|
||||
|
||||
public function sendUsage(){
|
||||
if($this->lastSendUsage instanceof SendUsageTask){
|
||||
if(!$this->lastSendUsage->isGarbage()){ //do not call multiple times
|
||||
|
@ -56,6 +56,10 @@ memory:
|
||||
max-chunks:
|
||||
#Limit of chunks to load per player, overrides chunk-sending.max-chunks
|
||||
trigger-limit: 96
|
||||
|
||||
#Do chunk garbage collection on trigger
|
||||
trigger-chunk-collect: true
|
||||
|
||||
#Trigger on low memory
|
||||
low-memory-trigger: true
|
||||
|
||||
@ -117,9 +121,6 @@ chunk-generation:
|
||||
#Max. amount of chunks in the waiting queue to be populated
|
||||
population-queue-size: 2
|
||||
|
||||
chunk-gc:
|
||||
period-in-ticks: 600
|
||||
|
||||
ticks-per:
|
||||
animal-spawns: 400
|
||||
monster-spawns: 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user