Skip to content

Commit

Permalink
Avoid memory leak for thread-local values
Browse files Browse the repository at this point in the history
Setting the thread-local value to `null` is not the same as removing it.
The former retains an entry mapping the current thread's value to `null`
in a hidden global map.  The latter removes the current thread's entry
entirely.
  • Loading branch information
liblit committed Sep 6, 2023
1 parent e8967ec commit 9962d3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shrike/src/main/java/com/ibm/wala/shrike/cg/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static String bashToDescriptor(String className) {
}

public static void execution(String klass, String method, Object receiver) {
runtime.currentSite.set(null);
runtime.currentSite.remove();
if (runtime.filter == null || !runtime.filter.contains(bashToDescriptor(klass))) {
if (runtime.output != null) {
String caller = runtime.callStacks.get().peek();
Expand Down Expand Up @@ -183,7 +183,7 @@ public static void pop() {
}
}

runtime.currentSite.set(null);
runtime.currentSite.remove();
}
}

Expand Down

0 comments on commit 9962d3c

Please sign in to comment.