Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable JRuby's Variable Sharing feature #715

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

matthias-fratz-bsz
Copy link
Contributor

This avoids a memory leak in JRuby 9.4.3.0 (probably at least 9.4.x).

If Variable Sharing is enabled, JRuby stores all Ruby instance variables into a BiVariableMap object for access from Java. As of the current 9.4.10.0 development version, this BiVariable object is never removed from its BiVariableMap, and thus never gets garbage-collected. JRubyDelegateProxy creates a new instance of the Ruby CustomDelegate object, so any use of instance variables in that object leaks a bit of memory after each request. This eventually grinds Cantaloupe to a halt.

Disabling Variable Sharing is a workaround until this can be fixed in JRuby. JRuby's Variable Sharing feature isn't needed by the code in JRubyDelegateProxy.

This memory leak is similar to the one described in #712, but the mechanism is slightly different. I'm proposing the workaround because according to synthetic tests, it should also reduce the impact of that other leak quite significantly.

This avoids a memory leak in JRuby 9.4.3.0 (probably at least 9.4.x).
@glenrobson
Copy link
Contributor

Note related issue: jruby/jruby#8527

@jcoyne jcoyne merged commit 3242e89 into cantaloupe-project:develop Dec 18, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants