src/share/vm/gc/g1/g1CollectedHeap.cpp

Print this page

        

@@ -1793,10 +1793,18 @@
   }
 
   assert(!collector_policy()->should_clear_all_soft_refs(),
          "Flag should have been handled and cleared prior to this point");
 
+  // We may shrink heap too much after full gc.
+  // Expand heap will help - JDK-8130265
+  result = expand_and_allocate(word_size, context);
+  if (result != NULL) {
+    assert(*succeeded, "sanity");
+    return result;
+  }
+
   // What else?  We might try synchronous finalization later.  If the total
   // space available is large enough for the allocation, then a more
   // complete compaction phase than we've tried so far might be
   // appropriate.
   assert(*succeeded, "sanity");