Skip to content

Fix an embedded runtime memory leak in Java7ClassValue#3228

Merged
headius merged 1 commit intojruby:masterfrom
bbrowning:classvalue-runtime-leak
Aug 29, 2015
Merged

Fix an embedded runtime memory leak in Java7ClassValue#3228
headius merged 1 commit intojruby:masterfrom
bbrowning:classvalue-runtime-leak

Conversation

@bbrowning
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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.

2 participants