Clean up code around JRuby 10, re-enable optimizations#85
Merged
Conversation
This commit removes a statement that disabled JRuby's InvokeDynamic optimization for `yield` statements. Prior to JRuby 9.2.15.0, there was a JRuby compiler bug that caused this optimization to eventually produce a stack overflow. This bug was fixed in jruby/jruby#6260 and the optimization should be safe to re-enable. If needed, this optimization can be disabled again by adding `-Djruby.invokedynamic.yield=false` to `JAVA_ARGS`. Signed-off-by: Charlie Sharpsteen <charlie@overlookinfratech.com>
This commit removes a statement that overrode JRuby's behavior for tracking proxy objects created for Ruby<->Java interop from the default value of `STABLE` to the legacy value of `HARD_MAP`. The `STABLE` default had a memory leak that was fixed in JRuby 10.0.5.0 by jruby/jruby#9359. `STABLE` uses weak references to proxy objects that are stored outside of the JRuby instance instead of a hashmap of strong references owned by the instance. Switching to `STABLE` should allow the JVM to garbage collect un-used proxies --- especially as the JRuby pool no longer defaults to destroying and re-creating instances, and their associated hashmaps, after a certain number of requests. If needed, tracking of proxy objects can be set back to using a hashmap by adding `-Djruby.ji.class.values=HARD_MAP` to `JAVA_ARGS`. Signed-off-by: Charlie Sharpsteen <charlie@overlookinfratech.com>
Signed-off-by: Charlie Sharpsteen <charlie@overlookinfratech.com>
Signed-off-by: Charlie Sharpsteen <charlie@overlookinfratech.com>
bastelfreak
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Short description
This changeset includes a few cleanups of dead code and option overrides that are no longer relevant:
jruby.invokedynamic.yieldsetting is allowed to use its default value oftrue. The memory leak that prompted the override tofalsewas fixed long ago, and having this enabled allows the JRuby compiler to optimize Rubyyieldkeywords.jruby.ji.class.valuesis allowed to use its default value ofSTABLE. The memory leak that prompted the override toHARD_MAPwas resolved in JRuby 10.0.5.0, and the default ofSTABLEshould be better for long-lived JRuby instances --- which all JRubies are due to the defaultmax-borrows-per-instance: 0Checklist
I have:
Signed-off-byannotation to each of my commitsGenerated-byorAssisted-byannotations to each of my commits created with the help of an AI agent