The Twilight Forest

The Twilight Forest

140M Downloads

Multipart Entity Memory Leak

Meldexun opened this issue ยท 1 comments

commented

Forge Version

36.2.34

Twilight Forest Version

4.0.870

Client Log

No response

Crash Report (if applicable)

No response

Steps to Reproduce

  1. Create a new world
  2. Spawn a TwilightForest multipart entity (for example Naga)
  3. Leave the world
  4. Create heap dump

What You Expected

No world objects staying loaded in memory

What Happened Instead

ClientWorld and ServerWorld objects stay loaded in memory

Additional Details

private static final WeakHashMap<Level, List<TFPart<?>>> cache = new WeakHashMap<>();

Only the keys of a WeakHashMap are weak and thus the values of this map prevent the keys (world objects) from being garbage collected.

This code is used in the 1.16, 1.17 and 1.18 version of the mod and thus this affects all these versions.

Please Read and Confirm The Following

  • I have confirmed this bug can be replicated without the use of Optifine.
  • I have confirmed the details provided in this report are concise as possible and does not contained vague information (ie. Versions are properly recorded, answers to questions are clear).
  • I have confirmed this issue is unique and has not been reported already.
commented

I'm actually aware of this one but have totally forgotten about it. Thanks for the reminder.