Release strong weak references on close, closes #1883

This commit is contained in:
Shoghi Cervantes 2014-08-15 13:41:13 +02:00
parent 9c95441402
commit f60e2860e8
4 changed files with 5 additions and 33 deletions

View File

@ -74,7 +74,6 @@ use pocketmine\plugin\Plugin;
use pocketmine\plugin\PluginLoadOrder;
use pocketmine\plugin\PluginManager;
use pocketmine\scheduler\CallbackTask;
use pocketmine\scheduler\PHPGarbageCollectionTask;
use pocketmine\scheduler\SendUsageTask;
use pocketmine\scheduler\ServerScheduler;
use pocketmine\tile\Tile;
@ -1584,8 +1583,6 @@ class Server{
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "doLevelGC"]), $this->getProperty("chunk-gc.period-in-ticks", 600), $this->getProperty("chunk-gc.period-in-ticks", 600));
}
$this->scheduler->scheduleRepeatingTask(new PHPGarbageCollectionTask(), 100);
$this->enablePlugins(PluginLoadOrder::POSTWORLD);
}
@ -1743,6 +1740,7 @@ class Server{
*/
public function shutdown(){
$this->isRunning = false;
gc_collect_cycles();
}
public function forceShutdown(){
@ -1818,6 +1816,8 @@ class Server{
$this->tickProcessor();
$this->forceShutdown();
gc_collect_cycles();
}
public function checkTicks(){

View File

@ -1050,6 +1050,7 @@ abstract class Entity extends Position implements Metadatable{
}
$this->getLevel()->removeEntity($this);
$this->despawnFromAll();
$this->level->release();
}
}

View File

@ -1,30 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
*
*
*/
namespace pocketmine\scheduler;
class PHPGarbageCollectionTask extends Task{
public function onRun($currentTicks){
gc_collect_cycles();
}
}

View File

@ -113,6 +113,7 @@ abstract class Tile extends Position{
unset(Tile::$needUpdate[$this->id]);
$this->getLevel()->removeTile($this);
$this->chunk->removeTile($this);
$this->level->release();
}
}