EssentialsX

EssentialsX

2M Downloads

AlternativeCommandsHandler is preventing commands from being gc'ed

OOP-778 opened this issue ยท 1 comments

commented

Type of bug

Performance issue or memory leak

/ess dump all output

Doesn't need one

Error log (if applicable)

No response

Bug description

Whenever having a plugin that loads modules at runtime & reloads them, issue is the modules classloaders are not able to GC because of the commands being stored in a List in AlternativeCommandsHandler.

Steps to reproduce

Create a module system that loads modules from a plugin at runtime

Expected behaviour

The commands should not prevent the classloader to unload.

Actual behaviour

The classloader GC root becomes commands located inside AlternativeCommandsHandler

commented

I've made a funky patch located here.
https://github.com/OOP-778/Essentials
If anyone wants to do a proper merge request or do a proper patch, go ahead.

The references should be expunged from the list whenever the list accessed.