--- old/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp 2014-07-15 10:22:41.036256136 +0200 +++ new/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp 2014-07-15 10:22:40.957253819 +0200 @@ -176,6 +176,12 @@ #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); @@ -253,6 +259,12 @@ } 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) {