AsyncPool: Slightly reduce worker memory usage with more conservative start options

this results in a memory footprint reduction of maybe 4MB for a total of 8 workers. Not much, but it's something.
This commit is contained in:
Dylan K. Taylor
2018-06-10 10:18:07 +01:00
parent f3a84b332b
commit 3725bea3e5
4 changed files with 32 additions and 13 deletions

View File

@ -26,6 +26,7 @@ namespace pocketmine\scheduler;
use pocketmine\Server;
class AsyncPool{
private const WORKER_START_OPTIONS = PTHREADS_INHERIT_INI | PTHREADS_INHERIT_CONSTANTS;
/** @var Server */
private $server;
@ -62,7 +63,7 @@ class AsyncPool{
$this->workerUsage[$i] = 0;
$this->workers[$i] = new AsyncWorker($this->logger, $i + 1, $this->workerMemoryLimit);
$this->workers[$i]->setClassLoader($this->classLoader);
$this->workers[$i]->start();
$this->workers[$i]->start(self::WORKER_START_OPTIONS);
}
}
@ -76,7 +77,7 @@ class AsyncPool{
$this->workerUsage[$i] = 0;
$this->workers[$i] = new AsyncWorker($this->logger, $i + 1, $this->workerMemoryLimit);
$this->workers[$i]->setClassLoader($this->classLoader);
$this->workers[$i]->start();
$this->workers[$i]->start(self::WORKER_START_OPTIONS);
}
$this->size = $newSize;
}