Skip to content

Commit e965dca

Browse files
committed
8231249: Shenandoah: GC retries are too aggressive for tests that expect OOME
Reviewed-by: rkennke
1 parent 6bc9833 commit e965dca

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -809,22 +809,12 @@ HeapWord* ShenandoahHeap::allocate_memory(ShenandoahAllocRequest& req) {
809809
// way later after GC happened, only to fail the second allocation, because
810810
// other threads have already depleted the free storage. In this case, a better
811811
// strategy is to try again, as long as GC makes progress.
812-
//
813-
// Then, we need to make sure the allocation was retried after at least one
814-
// Full GC, which means we want to try more than ShenandoahFullGCThreshold times.
815-
816-
size_t tries = 0;
817-
818-
while (result == NULL && _progress_last_gc.is_set()) {
819-
tries++;
820-
control_thread()->handle_alloc_failure(req.size());
821-
result = allocate_memory_under_lock(req, in_new_region);
822-
}
823812

824-
while (result == NULL && tries <= ShenandoahFullGCThreshold) {
825-
tries++;
826-
control_thread()->handle_alloc_failure(req.size());
827-
result = allocate_memory_under_lock(req, in_new_region);
813+
if (result == NULL) {
814+
do {
815+
control_thread()->handle_alloc_failure(req.size());
816+
result = allocate_memory_under_lock(req, in_new_region);
817+
} while (result == NULL && _progress_last_gc.is_set());
828818
}
829819

830820
} else {

0 commit comments

Comments
 (0)