Open laumacirule opened 2 weeks ago
Thanks for this! There's definitely some cleanup here we should probably add to JRuby's normal runtime teardown.
But first, I need to know: what is the lifecycle of one of your JRuby-based plugins related to the normal JRuby lifecycle? Specifically, do you do this cleanup followed by a call to org.jruby.Ruby.tearDown
or the ScriptingContainer
equivalent?
I think we can get most of this into JRuby's teardown, especially if it helps GC the rest of the runtime instance sooner!
Marked for 9.4.9.0 but it may be too much to add in a maintenance release. Additional cleanup could easily run into new errors if there are environments already doing the same cleanup or depending (perhaps incorrectly) on some of these resources not being cleaned up.
Environment Information
jruby 9.4.8.0 (3.1.4) 2024-07-02 4d41e55a67 OpenJDK 64-Bit Server VM 11.0.23+9 on 11.0.23+9 [arm64-darwin]
)Actual Behavior To allow garbage collection as soon as possible, we call the following methods to release memory once a JRuby plugin is shut down, but the base JVM process keeps running.
Expected Behavior
The above teardown actions could be added to the
org.jruby.Ruby.teardown
logic to fully free up the memory that JRuby used.