Skip to content

Commit 50b63b2

Browse files
authored
Merge pull request ibmruntimes#851 from JasonFengJ9/gcproof
Hold the testLoader reference to prevent GC
2 parents bf34de6 + 026c6f8 commit 50b63b2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

+2
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)