diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index b7573380c..28d06e4fd 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -116,7 +116,7 @@ namespace pocketmine { ini_set("display_startup_errors", 1); ini_set("default_charset", "utf-8"); - ini_set("memory_limit", "256M"); //Default + ini_set("memory_limit", -1); define("pocketmine\\START_TIME", microtime(true)); $opts = getopt("", ["enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"]); diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 12de4db03..438d92973 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1508,7 +1508,7 @@ class Server{ $this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, [ "motd" => "Minecraft: PE Server", "server-port" => 19132, - "memory-limit" => "256M", + "memory-limit" => -1, "white-list" => false, "announce-player-achievements" => true, "spawn-protection" => 16, @@ -1558,15 +1558,15 @@ class Server{ $this->maxPlayers = $this->getConfigInt("max-players", 20); $this->setAutoSave($this->getConfigBoolean("auto-save", true)); - if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){ + if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", -1)))) !== false and $memory > 1){ $value = ["M" => 1, "G" => 1024]; $real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)]; if($real < 128){ - $this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM", true, true, 0); + $this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM"); } @ini_set("memory_limit", $memory); }else{ - $this->setConfigString("memory-limit", "256M"); + $this->setConfigString("memory-limit", -1); } if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3){ @@ -1852,7 +1852,7 @@ class Server{ $this->properties->reload(); $this->maxPlayers = $this->getConfigInt("max-players", 20); - if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){ + if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", -1)))) !== false and $memory > 1){ $value = ["M" => 1, "G" => 1024]; $real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)]; if($real < 256){ @@ -1860,7 +1860,7 @@ class Server{ } @ini_set("memory_limit", $memory); }else{ - $this->setConfigString("memory-limit", "256M"); + $this->setConfigString("memory-limit", -1); } if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3){ diff --git a/src/pocketmine/command/CommandReader.php b/src/pocketmine/command/CommandReader.php index 96477a58d..9695d438c 100644 --- a/src/pocketmine/command/CommandReader.php +++ b/src/pocketmine/command/CommandReader.php @@ -32,7 +32,7 @@ class CommandReader extends Thread{ /** * @param \Threaded $threaded */ - public function __construct(\Threaded $threaded){ + public function __construct(){ $this->buffer = \ThreadedFactory::create(); $this->start(); } diff --git a/src/pocketmine/level/generator/GenerationThread.php b/src/pocketmine/level/generator/GenerationThread.php index c2286ce21..c7241d709 100644 --- a/src/pocketmine/level/generator/GenerationThread.php +++ b/src/pocketmine/level/generator/GenerationThread.php @@ -77,7 +77,7 @@ class GenerationThread extends Thread{ return $this->logger; } - public function __construct(\Threaded $internalThreaded, \Threaded $externalThreaded, \ThreadedLogger $logger, \ClassLoader $loader){ + public function __construct(\ThreadedLogger $logger, \ClassLoader $loader){ $this->loader = $loader; $this->logger = $logger; $loadPaths = []; diff --git a/src/pocketmine/resources/pocketmine.yml b/src/pocketmine/resources/pocketmine.yml index cee9d001c..2d573a04d 100644 --- a/src/pocketmine/resources/pocketmine.yml +++ b/src/pocketmine/resources/pocketmine.yml @@ -52,8 +52,7 @@ chunk-generation: #Whether to run the generation on a different thread or on the main thread #Generation will be less glitchy on the main thread, but will lag more #Using this with fast generators is recommended - #If enabled, the dedicated generation thread may leak memory - use-async: false + use-async: true #Max. amount of chunks to generate per tick, only for use-async: false per-tick: 1 @@ -101,4 +100,4 @@ worlds: #Example: #world: # seed: 404 - # generator: FLAT:2;7,59x1,3x3,2;1;decoration(treecount=80 grasscount=45) \ No newline at end of file + # generator: FLAT:2;7,59x1,3x3,2;1;decoration(treecount=80 grasscount=45)