Psi

Psi

45M Downloads

Memory leak

MJavad opened this issue ยท 5 comments

commented

I'm using FTB Beyond 1.10.0 which is on minecraft 1.10.2 with Psi r1.0-42 and SpongeForge.
There is a memory leak every time I take a CAD in my inventory that eventually leads to server crash.
I searched issues and take a look at change log but it doesn't seem to be fixed in a new version.
These are my memory samples which both are taken after forcing a GC, first without CAD and second with CAD after memory fills up (about 45 seconds).

before
after

There are 9 million HashMaps that are generated, And there seem to be a relation with issue #306.
If you need me to provide any further information please ask.

commented

I don't use any HashMaps at all on ItemCAD. I'll have to redirect this one to Sponge.

commented

@MJavad You should find out what is the specific biggest HashMap, what class is it a member of. You may need to switch to YourKit, I'm not sure whether VisualVM can do it all.

commented

@Ricket I switched to YourKit but i'm actually having trouble tracking the issue.
I'm monitoring my server remotely and I can't transfer memory snapshots because of their huge size.
I tried working with memory allocation monitor but it seems to reduce the memory leak so it's hard to reproduce the problem while recording.
What do you think? Is there anyway to reduce size of memory snapshot or other ways to find it?

commented

Is this still a issue on 1.12.2? I'm finding myself with the same problem, atm.

commented

SpellPiece should implement equals/hashCode in order for this one to be definitely safe: (it could also maybe be made a WeakHashMap) https://github.com/Vazkii/Psi/blob/32c6e01703a8e663bca3f723376139a403fd5bc3/src/main/java/vazkii/psi/api/spell/CompiledSpell.java#L33

And also maybe this map could be made a WeakHashMap<EntityPlayer, PlayerData> (Entity has an equals/hashCode implementation) -- assuming the same EntityPlayer instance is kept for the life of the player being connected to the server:
https://github.com/Vazkii/Psi/blob/32c6e01703a8e663bca3f723376139a403fd5bc3/src/main/java/vazkii/psi/common/core/handler/PlayerDataHandler.java#L83