Expected Behavior
I embed JRuby into openHAB, using the JSR223 interface (since that's how openHAB handles several different scripting languages). A new ScriptEngine is created for each script, including if it's reloaded because I've changed it. openHAB's core code that manages scripts will check if the ScriptEngine implements AutoCloseable when it's unloading a script, and call close() on it if it does. But JRubyEngine doesn't implement AutoCloseable, nor does it have any way to access the ScriptingContainer in order for me to call terminate myself. I would expect it to implement AutoCloseable, and calling close() on the engine will just call container.terminate().
Actual Behavior
When I reload a lot of scripts, my memory usage goes up, and eventually I get to the point where GC is using 100% CPU because it's having such a hard time freeing up resources from old engines.
Expected Behavior
I embed JRuby into openHAB, using the JSR223 interface (since that's how openHAB handles several different scripting languages). A new
ScriptEngineis created for each script, including if it's reloaded because I've changed it. openHAB's core code that manages scripts will check if theScriptEngineimplementsAutoCloseablewhen it's unloading a script, and call close() on it if it does. ButJRubyEnginedoesn't implementAutoCloseable, nor does it have any way to access the ScriptingContainer in order for me to callterminatemyself. I would expect it to implementAutoCloseable, and callingclose()on the engine will just callcontainer.terminate().Actual Behavior
When I reload a lot of scripts, my memory usage goes up, and eventually I get to the point where GC is using 100% CPU because it's having such a hard time freeing up resources from old engines.