Commit d6f8b46 Thomas Schatzl
committed Oct 17, 2024
1 parent 8e16e67 commit d6f8b46 Copy full SHA for d6f8b46
File tree 1 file changed +4
-3
lines changed
test/hotspot/jtreg/vmTestbase/gc/gctests/PhantomReference/phantom001
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -177,14 +177,15 @@ public void run() {
177
177
// If referent is finalizable, provoke GCs and wait for finalization.
178
178
if (type .equals ("class" )) {
179
179
progress ("Waiting for finalization: " + type );
180
+ WhiteBox .getWhiteBox ().fullGC ();
180
181
for (int checks = 0 ; !finalized && !shouldTerminate (); ++checks ) {
181
- // There are scenarios where one WB.fillGC() isn't enough,
182
- // but 10 iterations really ought to be sufficient.
182
+ // Wait for up to 10 iterations that the finalizer has been run,
183
+ // this ought to be sufficient. Full GCs and other threads might
184
+ // starve out the finalizer thread, requiring more waiting.
183
185
if (checks > 10 ) {
184
186
fail ("Waiting for finalization: " + type );
185
187
return ;
186
188
}
187
- WhiteBox .getWhiteBox ().fullGC ();
188
189
// Give some time for finalizer to run.
189
190
try {
190
191
Thread .sleep (checks * 100 );
You can’t perform that action at this time.
0 commit comments