mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Fixed crash when memory hard limit is disabled, close #1074
This commit is contained in:
parent
433b8369f5
commit
3167817e34
@ -92,7 +92,7 @@ class MemoryManager{
|
|||||||
$hardLimit = ((int) $this->server->getProperty("memory.main-hard-limit", $defaultMemory));
|
$hardLimit = ((int) $this->server->getProperty("memory.main-hard-limit", $defaultMemory));
|
||||||
|
|
||||||
if($hardLimit <= 0){
|
if($hardLimit <= 0){
|
||||||
ini_set("memory_limit", -1);
|
ini_set("memory_limit", '-1');
|
||||||
}else{
|
}else{
|
||||||
ini_set("memory_limit", $hardLimit . "M");
|
ini_set("memory_limit", $hardLimit . "M");
|
||||||
}
|
}
|
||||||
|
@ -1999,9 +1999,11 @@ class Server{
|
|||||||
$this->getLogger()->debug("Removing event handlers");
|
$this->getLogger()->debug("Removing event handlers");
|
||||||
HandlerList::unregisterAll();
|
HandlerList::unregisterAll();
|
||||||
|
|
||||||
$this->getLogger()->debug("Stopping all tasks");
|
if($this->scheduler instanceof ServerScheduler){
|
||||||
$this->scheduler->cancelAllTasks();
|
$this->getLogger()->debug("Stopping all tasks");
|
||||||
$this->scheduler->mainThreadHeartbeat(PHP_INT_MAX);
|
$this->scheduler->cancelAllTasks();
|
||||||
|
$this->scheduler->mainThreadHeartbeat(PHP_INT_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
$this->getLogger()->debug("Saving properties");
|
$this->getLogger()->debug("Saving properties");
|
||||||
$this->properties->save();
|
$this->properties->save();
|
||||||
@ -2010,10 +2012,12 @@ class Server{
|
|||||||
$this->console->shutdown();
|
$this->console->shutdown();
|
||||||
$this->console->notify();
|
$this->console->notify();
|
||||||
|
|
||||||
$this->getLogger()->debug("Stopping network interfaces");
|
if($this->network instanceof Network){
|
||||||
foreach($this->network->getInterfaces() as $interface){
|
$this->getLogger()->debug("Stopping network interfaces");
|
||||||
$interface->shutdown();
|
foreach($this->network->getInterfaces() as $interface){
|
||||||
$this->network->unregisterInterface($interface);
|
$interface->shutdown();
|
||||||
|
$this->network->unregisterInterface($interface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gc_collect_cycles();
|
gc_collect_cycles();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user