Skip to content

Instantly share code, notes, and snippets.

@headius
Created May 8, 2012 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/2639787 to your computer and use it in GitHub Desktop.
Save headius/2639787 to your computer and use it in GitHub Desktop.
diff --git a/src/org/jruby/Ruby.java b/src/org/jruby/Ruby.java
index 35def50..84ef7f3 100644
--- a/src/org/jruby/Ruby.java
+++ b/src/org/jruby/Ruby.java
@@ -2883,6 +2883,14 @@ public final class Ruby {
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 {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment