Removed unnecessary and/or obsolete GC hacks

the intent of these hacks was to break cyclic references to avoid having objects lingering in memory. However, all of the stuff that's being removed in this commit no longer has any effect anyway, due to the fact that these things don't circularly reference each other anymore. Notably, Tile inventories now keep Position instead of a Tile ref.
This commit is contained in:
Dylan K. Taylor 2021-06-30 19:16:25 +01:00
parent c05f6db8d9
commit 91d54ff0ad
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
9 changed files with 0 additions and 49 deletions

View File

@ -53,7 +53,6 @@ class Barrel extends Spawnable implements Container, Nameable{
public function close() : void{
if(!$this->closed){
$this->inventory->removeAllViewers();
$this->inventory = null;
parent::close();
}
}

View File

@ -90,7 +90,6 @@ class BrewingStand extends Spawnable implements Container, Nameable{
public function close() : void{
if(!$this->closed){
$this->inventory->removeAllViewers();
$this->inventory = null;
parent::close();
}

View File

@ -108,8 +108,6 @@ class Chest extends Spawnable implements Container, Nameable{
$this->doubleInventory = null;
}
$this->inventory = null;
parent::close();
}
}

View File

@ -98,7 +98,6 @@ class Furnace extends Spawnable implements Container, Nameable{
public function close() : void{
if(!$this->closed){
$this->inventory->removeAllViewers();
$this->inventory = null;
parent::close();
}

View File

@ -63,7 +63,6 @@ class Hopper extends Spawnable implements Container, Nameable{
public function close() : void{
if(!$this->closed){
$this->inventory->removeAllViewers();
$this->inventory = null;
parent::close();
}

View File

@ -134,7 +134,6 @@ abstract class Tile{
if($this->pos->isValid()){
$this->pos->getWorld()->removeTile($this);
}
$this->pos = null;
}
}
}

View File

@ -1587,7 +1587,6 @@ abstract class Entity{
* It is expected that the object is unusable after this is called.
*/
protected function destroyCycles() : void{
$this->location = null;
$this->lastDamageCause = null;
}

View File

@ -521,7 +521,6 @@ class World implements ChunkManager{
$this->unregisterGenerator();
$this->provider->close();
$this->provider = null;
$this->blockCache = [];
$this->unloaded = true;

View File

@ -1,40 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Property pocketmine\\\\block\\\\tile\\\\Barrel\\:\\:\\$inventory \\(pocketmine\\\\block\\\\inventory\\\\BarrelInventory\\) does not accept null\\.$#"
count: 1
path: ../../../src/block/tile/Barrel.php
-
message: "#^Property pocketmine\\\\block\\\\tile\\\\BrewingStand\\:\\:\\$inventory \\(pocketmine\\\\block\\\\inventory\\\\BrewingStandInventory\\) does not accept null\\.$#"
count: 1
path: ../../../src/block/tile/BrewingStand.php
-
message: "#^Property pocketmine\\\\block\\\\tile\\\\Chest\\:\\:\\$inventory \\(pocketmine\\\\block\\\\inventory\\\\ChestInventory\\) does not accept null\\.$#"
count: 1
path: ../../../src/block/tile/Chest.php
-
message: "#^Property pocketmine\\\\block\\\\tile\\\\Furnace\\:\\:\\$inventory \\(pocketmine\\\\block\\\\inventory\\\\FurnaceInventory\\) does not accept null\\.$#"
count: 1
path: ../../../src/block/tile/Furnace.php
-
message: "#^Property pocketmine\\\\block\\\\tile\\\\Hopper\\:\\:\\$inventory \\(pocketmine\\\\block\\\\inventory\\\\HopperInventory\\) does not accept null\\.$#"
count: 1
path: ../../../src/block/tile/Hopper.php
-
message: "#^Property pocketmine\\\\block\\\\tile\\\\Tile\\:\\:\\$pos \\(pocketmine\\\\world\\\\Position\\) does not accept null\\.$#"
count: 1
path: ../../../src/block/tile/Tile.php
-
message: "#^Property pocketmine\\\\entity\\\\Entity\\:\\:\\$location \\(pocketmine\\\\entity\\\\Location\\) does not accept null\\.$#"
count: 1
path: ../../../src/entity/Entity.php
-
message: "#^Property pocketmine\\\\entity\\\\Human\\:\\:\\$enderInventory \\(pocketmine\\\\inventory\\\\PlayerEnderInventory\\) does not accept null\\.$#"
count: 1
@ -80,8 +45,3 @@ parameters:
count: 1
path: ../../../src/player/Player.php
-
message: "#^Property pocketmine\\\\world\\\\World\\:\\:\\$provider \\(pocketmine\\\\world\\\\format\\\\io\\\\WritableWorldProvider\\) does not accept null\\.$#"
count: 1
path: ../../../src/world/World.php