Dragon Survival [Forge]

Dragon Survival [Forge]

1M Downloads

[1.18.2 Forge Bug]: Severe memory leak due to constant initialisation of classes.

Whanos opened this issue · 2 comments

commented

■ Your Discord ID

protocol#6464

■ Dragon Survival version

DragonSurvival-1.18.2-1.5.42.jar

■ Single game or server?

Forge Server or host

■ Do you delete old configurations and check the Wiki before writing a bug report?

Nope (Default)

■ Do you play pure MC + DS and Geckolib or do you have some kind of modpack?

I have other mods

■ Describe the bug

The mod has a serious memory leak in the code - causing the mod to allocate many gigabytes of data, only ever being cleared by the GC. This is due to hundreds of thousands of copies of classes being instantiated.

The bug is due to this class being instantiated hundreds of thousands of times.

Said class is instantiated by this code seemingly many times every single tick , meaning that you are instantiating an insane amount of the same class.

Ultimately, the issue is seemingly caused by this class.

I strongly suggest looking at this section of code and caching this data, or at least severely reduce the amount of times you instantiate said data.

It appears one of your developers possibly knew about the severity of this issue four months ago.

This causes serious repeating performance issues on servers with limited RAM, as combined the mod can use almost 4GB of RAM at its peak - before the unused classes get wiped out of the heap by the GC.

■ To Reproduce

  1. Install the mod onto a forge server (I have not tested on single-player).
  2. Become a dragon.
  3. Profile the game after enabling JMX. using VisualVM or similar.
  4. Watch your memory allocation graph go wild.

■ Expected behavior

It not leaking memory.

■ Crash Report

No response

commented

Thank you very much for your issue, I will try to solve this problem as soon as possible.

commented

I will also complete this with one message from the discord server. Yesterday I tried to make a quick fix for this problem, but alas, it requires more complicated work. Thank you very much for your very detailed report.
image
image
image