Skip to content

Conversation

@Alexdoru
Copy link
Member

@Alexdoru Alexdoru commented Jun 3, 2025

Turns out when you unregister a forge event class instance, that class instance is still referenced in forge's event system thus not getting garbage collected

So I manually clear the World map data when unregistering the event to avoid leaking the World object.

On top of that the mod used the FMLServerStoppingEvent to clear the data which fires too early, before the WorldEvent.Unload event fires on the server side. So by using the FMLServerStoppedEvent instead the event handler can now run properly and clear the world map.

image

@serenibyss serenibyss merged commit ffb43ba into master Jun 4, 2025
1 check passed
@serenibyss serenibyss deleted the fix-mem-leak branch June 4, 2025 04:18
@Alexdoru Alexdoru changed the title Fix WorldServer leak [Memory-opti:fix leak] Fix WorldServer leak Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants