casperge / RealisticSeasons-issues

1 stars 0 forks source link

Memory leaks caused by unloaded worlds #238

Open MarcatoSound opened 4 weeks ago

MarcatoSound commented 4 weeks ago

Hey there! Developer of Mythic Dungeons here. We received a report of memory leaks and upon poking around in a heap dump found RealisticSeasons keeping a world in memory by holding on to it after it was unloaded. (Seen in the below picture.)

image

Mythic Dungeons does everything it can to mitigate this kind of issue, but with dynamic worlds there's only so much we can do.

The simplest solution for this would be to add an event handler for WorldUnloadEvent that clears the unloaded world from the worlds tracked by your SpringBlockTicker. You could also regularly check if the world is being tracked by Bukkit still with a Bukkit.getWorld(worldName), or use a WeakReference instead of if you'd rather not an event handler or don't have a convenient way to regularly check if the world is active.

By the way, love the plugin, looks really well-made! Keep up the good work.

casperge commented 1 week ago

Thank you for the detailed report, that will be fixed. Have a nice day!