src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp

Print this page
rev 6670 : fast reclaim main patch

@@ -174,10 +174,16 @@
     }
   }
 #endif // !PRODUCT
 
   if (obj_ptr == NULL) {
+    // The allocation failure may have been caused by attempted allocation of a
+    // humongous object. Detect this and process appropriately.
+    if (_g1h->isHumongous(word_sz)) {
+      _g1h->set_humongous_is_live(old);
+      return NULL;
+    }
     // This will either forward-to-self, or detect that someone else has
     // installed a forwarding pointer.
     return _g1h->handle_evacuation_failure_par(this, old);
   }
 

@@ -251,10 +257,16 @@
   }
   return obj;
 }
 
 HeapWord* G1ParScanThreadState::allocate_slow(GCAllocPurpose purpose, size_t word_sz) {
+  // We may have reached the slow path because we tried to allocate memory for a
+  // humongous object. This just indicates that that humongous object is live
+  // though.
+  if (_g1h->isHumongous(word_sz)) {
+    return NULL;
+  }
   HeapWord* obj = NULL;
   size_t gclab_word_size = _g1h->desired_plab_sz(purpose);
   if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
     G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose);
     add_to_alloc_buffer_waste(alloc_buf->words_remaining());