FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix memory leak in Concurrent/ThreadSafeLocalContextProvider by headius · Pull Request #8969 · jruby/jruby · GitHub

/ jruby Public

Fix memory leak in Concurrent/ThreadSafeLocalContextProvider - #8969

Merged
headius merged 4 commits into
jruby:jruby-9.4from
headius:contextprovider_leak_fix
Aug 20, 2025
Merged

Fix memory leak in Concurrent/ThreadSafeLocalContextProvider#8969
headius merged 4 commits into
jruby:jruby-9.4from
headius:contextprovider_leak_fix

Conversation

headius commented Aug 20, 2025

Copy link
Copy Markdown
Member

Re-push of #8483

Uses the Cleaner API to run LocalContext.remove() when a Thread has
terminated, but also eagerly calls all LocalContext.remove() on
terminate().
Cleaner is Java 9+, so it cannot be used on JRuby 9 because that is meant
to run on Java 8 and up.

The disadvantage wrt the Cleaner API is that this will leak a Thread if
`terminate()` is never called. At least it's a Daemon Thread so it doesn't
keep the JVM from exiting.
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConcurrentLocalContextProvider leaks memory per thread

2 participants


Back | FazBrowse Home | New Git URL