Memory Leak due to Rustic seeds and chickens
fraenkelc opened this issue ยท 3 comments
Affected Versions
Forge: 14.23.2.2611
Rustic: 1.0.1
b761357 introduced a huge memory leak to chickens. Every time a Chicken is updated it gets another new pair of AI Tempt tasks for tomatoes and chili added to its task list. Once chickens are alive for a bit their task list gets insanely long which affects both tick time and creates huge memory pressure.
net.minecraft.entity.ai.EntityAITasks.taskEntries
being a HashSet does not help here: EntityAITempt
does not override equals and hashcode
Yeesh... I guess I haven't learned my lesson about testing pull requests. I'll fix this at some point today.
I have the same issue. I saw a gazillion instances of net.minecraft.entity.ai.EntityAITempt
. After some investigation I was finally able to trace the issue down with the following BTrace script:
/* BTrace Script Template */
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
@BTrace public class AllMethods {
@OnMethod(
clazz="net.minecraft.entity.ai.EntityAITempt",
method="<init>"
)
public static void m(@ProbeClassName String probeClass, @ProbeMethodName String probeMethod) {
Threads.jstack();
println("");
}
}
Which gave me the following backtrace a gazillion times:
net.minecraft.entity.ai.EntityAITempt.<init>(SourceFile:25)
rustic.common.EventHandlerCommon.onPlayerHoldingSeeds(EventHandlerCommon.java:291)
net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1445_EventHandlerCommon_onPlayerHoldingSeeds_LivingUpdateEvent.invoke(.dynamic)
net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
net.minecraftforge.common.ForgeHooks.onLivingUpdate(ForgeHooks.java:556)
net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2086)
net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:295)
net.minecraft.world.World.func_72866_a(World.java:1990)
net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:831)
net.minecraft.world.World.func_72870_g(World.java:1952)
net.minecraft.world.World.func_72939_s(World.java:1756)
net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:612)
net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:765)
net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:666)
net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185)
net.minecraft.server.MinecraftServer.run(MinecraftServer.java:524)
java.lang.Thread.run(Unknown Source)