You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that if unregister is called and the event is never fired again (such as for startup events) the event listener will not be released from memory.
Additionally, there's no way to do this manually even though getListeners is public, since it requires the bus ID which is not exposed.
The text was updated successfully, but these errors were encountered:
As a work around, you can use Java WeakReferences to avoid the listeners preventing large objects from being garbage collected. Check out the PR linked above for an example.
ListenerList#forceRebuild
simply sets a boolean to true, and relies on the next event post to do the actual cleanup:https://github.com/MinecraftForge/EventBus/blob/master/src/main/java/net/minecraftforge/eventbus/ListenerList.java#L223-L231
This means that if unregister is called and the event is never fired again (such as for startup events) the event listener will not be released from memory.
Additionally, there's no way to do this manually even though
getListeners
is public, since it requires the bus ID which is not exposed.The text was updated successfully, but these errors were encountered: