Skip to content

Commit fa36855

Browse files
authored
Merge pull request #389 from JasonFengJ9/gcproof
keep Runnable r strongly reachable so that it is not reclaimable by GC
2 parents d3956a6 + 21caf34 commit fa36855

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ static void runTest() throws Exception {
9797
throw new RuntimeException("should fail to load the native library" +
9898
" by another class loader");
9999
} catch (UnsatisfiedLinkError e) {}
100+
// keep Runnable r strongly reachable so that it is not reclaimable by GC
101+
java.lang.ref.Reference.reachabilityFence(r);
100102
}
101103

102104
/*

0 commit comments

Comments
 (0)