Blood Magic

Blood Magic

90M Downloads

Memory leak when changing dimensions (client-side)

ViRb3 opened this issue ยท 1 comments

commented

Issue Description:

Memory leaks every time a player changes dimensions. After around 12 hours of gameplay the game's memory is full and you are forced to restart.

Steps to reproduce:

  1. Using the Compact Machines mod, create a new compact machine
  2. Start spamming right-click with a Personal Shrinking Device in hand, this will rapidly switch you insde and outside the pocket dimension
  3. After 10 minutes, the game crashes as it runs out of memory

Technical details:

Using JProfiler, I traced down the problem to WayofTime.bloodmagic.util.handler.event.GenericHandler. It seems to keep hundreds of references to net.minecraft.client.multiplayer.WorldClient which it never releases.


Affected Versions (Do not use "latest"):

  • BloodMagic: BloodMagic-1.12.2-2.4.3-105.jar
  • Minecraft: 1.12.2
  • Forge: 14.23.5.2852
commented

I suspect the issue is lack of unloading of entries in the following maps:

public static Map<World, Map<EntityPlayer, Double>> bounceMapMap = new HashMap<>();
public static Map<World, Map<EntityPlayer, Integer>> filledHandMapMap = new HashMap<>();
private static Map<World, Map<EntityAnimal, EntityAITarget>> targetTaskMapMap = new HashMap<>();
private static Map<World, Map<EntityAnimal, EntityAIBase>> attackTaskMapMap = new HashMap<>();
public static Map<World, Map<IMasterRitualStone, AreaDescriptor>> preventSpawnMap = new HashMap<>();
public static Map<World, Map<IMasterRitualStone, AreaDescriptor>> forceSpawnMap = new HashMap<>();