Skip to content

Commit

Permalink
Merge pull request #851 from JasonFengJ9/gcproof
Browse files Browse the repository at this point in the history
Hold the testLoader reference to prevent GC
  • Loading branch information
pshipton authored Oct 2, 2024
2 parents bf34de6 + 026c6f8 commit 50b63b2
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ static void runTest() throws Exception {
throw new RuntimeException("should fail to load the native library" +
" by another class loader");
} catch (UnsatisfiedLinkError e) {}
// keep Runnable r strongly reachable so that it is not reclaimable by GC
java.lang.ref.Reference.reachabilityFence(r);
}

/*
Expand Down

0 comments on commit 50b63b2

Please sign in to comment.