backport 23071d257 + deprecations: Extract process-related functions from Utils into a separate Process class

This commit is contained in:
Dylan K. Taylor
2019-03-24 18:57:32 +00:00
parent a8433697ad
commit 4635b93f4d
9 changed files with 218 additions and 117 deletions

View File

@ -27,6 +27,7 @@ use pocketmine\event\server\LowMemoryEvent;
use pocketmine\scheduler\DumpWorkerMemoryTask;
use pocketmine\scheduler\GarbageCollectionTask;
use pocketmine\timings\Timings;
use pocketmine\utils\Process;
use pocketmine\utils\Utils;
use function arsort;
use function count;
@ -236,7 +237,7 @@ class MemoryManager{
if(($this->memoryLimit > 0 or $this->globalMemoryLimit > 0) and ++$this->checkTicker >= $this->checkRate){
$this->checkTicker = 0;
$memory = Utils::getMemoryUsage(true);
$memory = Process::getMemoryUsage(true);
$trigger = false;
if($this->memoryLimit > 0 and $memory[0] > $this->memoryLimit){
$trigger = 0;