From 4f27bce5b34a9e2cbbca0b862761b629270e7fe7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 12 Mar 2017 10:53:27 +0000 Subject: [PATCH] Destroy NBT references when closing entities, alleviates memory issues on leaked Player objects This does NOT FIX THE ACTUAL ISSUES, only eliminates some of the symptoms. --- src/pocketmine/entity/Entity.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 31de771ac..012dc413b 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1643,10 +1643,15 @@ abstract class Entity extends Location implements Metadatable{ $this->despawnFromAll(); if($this->chunk !== null){ $this->chunk->removeEntity($this); + $this->chunk = null; } + if($this->getLevel() !== null){ $this->getLevel()->removeEntity($this); + $this->setLevel(null); } + + $this->namedtag = null; } }