< prev index next >

src/hotspot/share/gc/g1/vm_operations_g1.cpp

Print this page
rev 48467 : 8137099: G1 needs to "upgrade" GC within the safepoint if it can't allocate during that safepoint to avoid OoME
Summary: During a minor GC, if memory allocation fails, start a full GC within the same VM operation in the same safepoint. This avoids a race where the GC locker can prevent the full GC from occurring, and a premature OoME.
Reviewed-by:
Contributed-by: thomas.schatzl@oracle.com, axel.siebenborn@sap.com
rev 48469 : imported patch 8137099-sjohanns-messages
rev 48470 : [mq]: 8137099-erikd-review
rev 48471 : [mq]: 8137099-erikd-review2

@@ -137,11 +137,11 @@
   if (_pause_succeeded) {
     if (_word_size > 0) {
       // An allocation had been requested. Do it, eventually trying a stronger
       // kind of GC.
       _result = g1h->satisfy_failed_allocation(_word_size, _allocation_context, &_pause_succeeded);
-    } else if (g1h->no_more_regions_left_for_allocation()) {
+    } else if (!g1h->has_regions_left_for_allocation()) {
       // There has been a request to perform a GC to free some space. We have no
       // information on how much memory has been asked for. In case there are
       // absolutely no regions left to allocate into, do a maximally compacting full GC.
       log_info(gc, ergo)("Attempting maximally compacting collection");
       _pause_succeeded = g1h->do_full_collection(false, /* explicit gc */
< prev index next >