(1.12) Memory Leak: ModConfig#keepEntityAsVanillaCache
Meldexun opened this issue ยท 1 comments
Describe the bug
Entries of the map ModConfig#keepEntityAsVanillaCache
use entity instances as their keys. This means for every sheep entity for example there will be an entry in the map. Because the map is never cleared this means in theory the map will fill up more and more and require more and more memory.
The other problem with using entities as keys is that the entity object has a world field and thus a lot of other objects will also remain in memory despite not being used anymore.
Changing the map to Map<Class<? extends Entity>, Boolean>
should fix these issues while still working the same as before.
To Reproduce
Steps to reproduce the behavior:
- Join a world
- Leave the world
- See WorldClient instance not being garbage collected
Context (please complete the following information):
- Minecraft version: 1.12.2
- Forge version: 14.23.5.2855
- Mo' Bends version: 1.1.0