Lithium (Fabric)

Lithium (Fabric)

22M Downloads

Memory usage increases after Save and Quit

MESLewis opened this issue ยท 5 comments

commented

Version Information

lithium-fabric-mc1.17.1-0.7.4.jar

Expected Behavior

Memory usage should not increase after a save and quit is performed.

Actual Behavior

After multiple save and quit and loading of worlds (in single player, multiplayer is unknown) memory usage eventually increases to unplayable levels, causing frequent GC events when loading world and when playing.

Reproduction Steps

Load any single player world(some worlds have a greater impact, possibly redstone machines in spawn chunks)
Pause and Save and Quit to title
Load another world (can be same world, possibly greater effect if different world)
Repeat until symptoms begin (For me its around 10 loads for the same world, as little as 4 loads for alternating worlds)
First symptom will be pausing on the world loading screen.

Other Information

Only solution I've found is to exit minecraft completely and reload.

commented

I am unable to recreate this in a totally empty world, I am working on finding the exact cause. My normal world's spawn chunks contain a small iron farm, so I am working on recreating that to see if its the source

commented

This will be fixed in the next version without any further changes, because I already replaced the static map with a field in the entity system to be more compatible with the dimensional threading mod.

commented

I believe this is triggered by hoppers attempting to find entities. Lithium 0.7 - 0.7.4 do caching in a way that it is never cleared. A weak hash map is used for deduplication, the keys are the worlds, but due to an oversight, the values keep a reference to the world, preventing the worlds from being garbage collected

commented

This should be fixed with Lithium 0.7.5

commented

Doesn't seem fixed. Edit: no it is fixed, but the JVM takes a long time to GC old worlds it when it doesn't need the memory