Memory leak from PlayerAnimator with Rats "Chef's Toque" item
Ricket opened this issue ยท 1 comments
Minecraft version: 1.12.2
Wizardry version: 4.3.4
Environment: Server
Issue details: Minecraft starts extreme memory leaking, hits the limit, experiences long GC pauses. I took a heap dump and the majority memory is taken by playerLayerModels
inside of PlayerAnimator
:
Looking at the contained items, there are a lot of ModelChefToque from the rats mod (I have version rats-3.2.14-1.12.2):
In the game, I had received a "Chef's Toque" item from a loot crate and I put it into the helmet/head slot.
Other mods involved: rats-3.2.14-1.12.2
Possibly related to #669.
Rats is creating a new armour model every single tick: https://github.com/Alex-the-666/Rats/blob/4f4f24a94a885540ce87be9fbdf7ddd80bf9c10b/src/main/java/com/github/alexthe666/rats/server/items/ItemChefToque.java#L23
https://github.com/Alex-the-666/Rats/blob/4f4f24a94a885540ce87be9fbdf7ddd80bf9c10b/src/main/java/com/github/alexthe666/rats/client/ClientProxy.java#L330
Compare that with how I do it for wizard armour:
Wizardry/src/main/java/electroblob/wizardry/client/ClientProxy.java
Lines 129 to 147 in 486d55f
Normally the performance impact is minor but because PlayerAnimator
has to modify and then cache those models, it fills up the memory very quickly with old model objects. I should be able to add a safeguard against this by ignoring models if there are more than a certain number belonging to the same class. However, this is a bug in Rats because there is no need to create new model instances every tick.