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

Fix an embedded runtime memory leak in Java7ClassValue #3228

Merged
merged 1 commit into from
Aug 29, 2015

Conversation

bbrowning
Copy link
Contributor

Commit 09f15f9 enabled the
Java7ClassValue implementation by default which exposed a runtime
memory leak in the embedded use case. This fixes that leak by wrapping
values stored in the java.lang.ClassValue instance with a
WeakReference.

Commit 09f15f9 enabled the
Java7ClassValue implementation by default which exposed a runtime
memory leak in the embedded use case. This fixes that leak by wrapping
values stored in the java.lang.ClassValue instance with a
WeakReference.
@headius
Copy link
Member

headius commented Aug 6, 2015

Related screenshot: https://dl.dropboxusercontent.com/u/9213410/class-values-leak.png

I've posted a question to the mlvm-dev list asking whether this rooting is expected. I was under the impression that when the ClassValue goes away, the value it references should be dereferenced, as in ThreadLocal.

@bbrowning
Copy link
Contributor Author

For reference, I'm seeing this leak when using:

$ java -version
openjdk version "1.8.0_51"
OpenJDK Runtime Environment (build 1.8.0_51-b16)
OpenJDK 64-Bit Server VM (build 25.51-b03, mixed mode)

@bbrowning
Copy link
Contributor Author

Even if this turns out to be a bug upstream in Java and it gets fixed, we'll still need to disable the usage of Java7ClassValue by default and/or apply this patch. Otherwise we're enabling an embedded runtime memory leak by default.

@headius
Copy link
Member

headius commented Aug 29, 2015

Will just disable to use of ClassValue for now, pending a fix from OpenJDK folks.

headius added a commit that referenced this pull request Aug 29, 2015
headius added a commit that referenced this pull request Aug 29, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fix an embedded runtime memory leak in Java7ClassValue
@headius headius merged commit 9c91759 into jruby:master Aug 29, 2015
@headius headius added this to the JRuby 9.0.1.0 milestone Aug 29, 2015
headius added a commit that referenced this pull request Aug 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants