Skip to content

Commit

Permalink
Merge pull request #815 from JasonFengJ9/gcproof
Browse files Browse the repository at this point in the history
keep Runnable r strongly reachable so that it is not reclaimable by GC
  • Loading branch information
pshipton authored Oct 2, 2024
2 parents 64bd167 + 3347a52 commit 0674172
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,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 0674172

Please sign in to comment.