diff --git a/src/pocketmine/MemoryManager.php b/src/pocketmine/MemoryManager.php index bbca6a3ca..e3c429d78 100644 --- a/src/pocketmine/MemoryManager.php +++ b/src/pocketmine/MemoryManager.php @@ -214,87 +214,6 @@ class MemoryManager{ return $cycles; } - /** - * @param object $object - * - * @return string Object identifier for future checks - */ - public function addObjectWatcher($object){ - if(!is_object($object)){ - throw new \InvalidArgumentException("Not an object!"); - } - - - $identifier = spl_object_hash($object) . ":" . get_class($object); - - if(isset($this->leakInfo[$identifier])){ - return $this->leakInfo["id"]; - } - - $this->leakInfo[$identifier] = [ - "id" => $id = md5($identifier . ":" . $this->leakSeed++), - "class" => get_class($object), - "hash" => $identifier - ]; - $this->leakInfo[$id] = $this->leakInfo[$identifier]; - - $this->leakWatch[$id] = new \WeakRef($object); - - return $id; - } - - public function isObjectAlive($id){ - if(isset($this->leakWatch[$id])){ - return $this->leakWatch[$id]->valid(); - } - - return false; - } - - public function removeObjectWatch($id){ - if(!isset($this->leakWatch[$id])){ - return; - } - unset($this->leakInfo[$this->leakInfo[$id]["hash"]]); - unset($this->leakInfo[$id]); - unset($this->leakWatch[$id]); - } - - public function doObjectCleanup(){ - foreach($this->leakWatch as $id => $w){ - if(!$w->valid()){ - $this->removeObjectWatch($id); - } - } - } - - public function getObjectInformation($id, $includeObject = false){ - if(!isset($this->leakWatch[$id])){ - return null; - } - - $valid = false; - $references = 0; - $object = null; - - if($this->leakWatch[$id]->acquire()){ - $object = $this->leakWatch[$id]->get(); - $this->leakWatch[$id]->release(); - - $valid = true; - $references = getReferenceCount($object, false); - } - - return [ - "id" => $id, - "class" => $this->leakInfo[$id]["class"], - "hash" => $this->leakInfo[$id]["hash"], - "valid" => $valid, - "references" => $references, - "object" => $includeObject ? $object : null - ]; - } - public function dumpServerMemory($outputFolder, $maxNesting, $maxStringSize){ gc_disable(); diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 98b4e3302..f3dd7997f 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -73,7 +73,7 @@ namespace pocketmine { use pocketmine\wizard\Installer; const VERSION = "1.6dev"; - const API_VERSION = "1.13.0"; + const API_VERSION = "2.0.0"; const CODENAME = "[REDACTED]"; const MINECRAFT_VERSION = "v0.12.1 alpha"; const MINECRAFT_VERSION_NETWORK = "0.12.1"; diff --git a/src/pocketmine/metadata/MetadataValue.php b/src/pocketmine/metadata/MetadataValue.php index 866568032..fb273718f 100644 --- a/src/pocketmine/metadata/MetadataValue.php +++ b/src/pocketmine/metadata/MetadataValue.php @@ -24,8 +24,8 @@ namespace pocketmine\metadata; use pocketmine\plugin\Plugin; abstract class MetadataValue{ - /** @var \WeakRef */ - protected $owningPlugin; + /** @var Plugin */ + private $owningPlugin; protected function __construct(Plugin $owningPlugin){ $this->owningPlugin = new \WeakRef($owningPlugin);