From 9fd6a695f6e51dedc2b415812282000ecc89afb6 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 18 Nov 2014 13:42:24 +0100 Subject: [PATCH] Fixed permission-related memory leak --- src/pocketmine/Player.php | 9 +++++++++ src/pocketmine/entity/Entity.php | 1 + 2 files changed, 10 insertions(+) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 2b05bd4f5..95cb20af9 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1059,6 +1059,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $revert = true; $this->nextChunkOrderRun = 0; }else{ + if($this->chunk instanceof FullChunk){ + $this->chunk->removeEntity($this); + } $this->chunk = $chunk; } } @@ -2340,12 +2343,18 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->loadQueue = []; $this->hasSpawned = []; $this->spawnPosition = null; + $this->perm->clearPermissions(); + $this->perm = null; unset($this->buffer); } $this->server->removePlayer($this); } + public function __debugInfo(){ + return []; + } + /** * Handles player data saving */ diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 7df739a2f..8ac019a8d 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -176,6 +176,7 @@ abstract class Entity extends Location implements Metadatable{ $this->id = Entity::$entityCount++; $this->justCreated = true; $this->namedtag = $nbt; + $this->chunk = $chunk; $this->setLevel($chunk->getProvider()->getLevel()); $this->server = $chunk->getProvider()->getLevel()->getServer();