Fix minor memory leaks (#258)

* Fix memory leak caused by mob spawner items

* Use a weak hash map instead of manually clearing the map

* Clear manager reference to prevent holding a WorldClient reference through the GUI

* Revert "Use a weak hash map instead of manually clearing the map"

This reverts commit 91bb997250.
This commit is contained in:
embeddedt authored and GitHub committed 2022-06-06 17:05:02 +02:00
1 parent d20a80a77c
commit de2b2ece69
2 files changed
+10

No files matched your search

@@ -299,6 +299,10 @@ public class ClientHandler
lastworld = null;
else if (gui instanceof GuiSelectWorld)
NEIClientConfig.reloadSaves();
else if(gui == null) {
/* prevent WorldClient reference being held in the Gui */
NEIController.manager = null;
}
}
lastGui = gui;
}
@@ -328,6 +332,8 @@ public class ClientHandler
if (!Minecraft.getMinecraft().isSingleplayer())//wait for server to initiate in singleplayer
NEIClientConfig.loadWorld("remote/" + ClientUtils.getServerIP().replace(':', '~'));
ItemMobSpawner.clearEntityReferences(world);
}
lastworld = world;