SelectorMenu/InventoryMenu memory leak
ItsHarry opened this issue ยท 0 comments
I found out what is causing InventoryMenu.onInvClick() to consume almost 30% of CPU time.
New instances of SelectorMenu are made each time the menu is opened using the following line of code:
new SelectorMenu().showTo(player);
The super class InventoryMenu registers a new listener in the constructor, but never unregisters it, causing it to leak.
The server PluginManager has to invoke the event thousands of times, which is obviously very slow.