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

Projects
None yet
2 participants
@bbrowning
Copy link
Contributor

bbrowning commented Aug 6, 2015

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.

Fix an embedded runtime memory leak in Java7ClassValue
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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

bbrowning commented Aug 7, 2015

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

This comment has been minimized.

Copy link
Contributor Author

bbrowning commented Aug 18, 2015

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

This comment has been minimized.

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

Merge pull request #3228 from bbrowning/classvalue-runtime-leak
Fix an embedded runtime memory leak in Java7ClassValue

@headius headius merged commit 9c91759 into jruby:master Aug 29, 2015

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

@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
You can’t perform that action at this time.