From da4c9cf4042a39dc17ff9099f8211fd0e6eb1285 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 23 Aug 2017 13:13:15 +0100 Subject: [PATCH] Fixed inventory cyclic references causing players to not get garbage-collected --- src/pocketmine/Player.php | 1 + src/pocketmine/entity/Human.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 2003a1241..b19c93ac7 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3503,6 +3503,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->removeAllWindows(true); $this->windows = null; $this->windowIndex = []; + $this->cursorInventory = null; if($this->constructed){ parent::close(); diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 436bd2f44..e75af5be3 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -537,6 +537,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ foreach($this->inventory->getViewers() as $viewer){ $viewer->removeWindow($this->inventory); } + + $this->inventory = null; } parent::close(); }