Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Partial solution for #162.

This clears the ThreadLocal objects out, so they can GC, but it
causes the referenced objects to linger because ThreadLocal's weak
referencing still requires a few GC cycles. The better fix will be
to not use Ruby objects in the thread-locals, but that requires a
reimplementation of the recursion logic.
  • Loading branch information...
commit 268fdc450f3beae032ca05dd3e8c75434a4597fb 1 parent 5c34c08
@headius headius authored João Duarte committed
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/org/jruby/Ruby.java
View
8 src/org/jruby/Ruby.java
@@ -2774,6 +2774,14 @@ public void tearDown() {
public void tearDown(boolean systemExit) {
int status = 0;
+ // clear out threadlocals so they don't leak
+ recursive = new ThreadLocal<Map<String, RubyHash>>();
+ recursiveKey = new ThreadLocal<RubySymbol>() {
+ protected RubySymbol initialValue() {
+ return newSymbol("__recursive_key__");
+ }
+ };
+
while (!atExitBlocks.empty()) {
RubyProc proc = atExitBlocks.pop();
try {
Please sign in to comment.
Something went wrong with that request. Please try again.