--- old/src/share/vm/memory/collectorPolicy.cpp 2013-03-19 10:34:08.000000000 -0400 +++ new/src/share/vm/memory/collectorPolicy.cpp 2013-03-19 10:34:08.000000000 -0400 @@ -539,7 +539,7 @@ Generation *gen0 = gch->get_gen(0); assert(gen0->supports_inline_contig_alloc(), "Otherwise, must do alloc within heap lock"); - if (gen0->should_allocate(size, is_tlab)) { + if (gen0 != NULL && gen0->should_allocate(size, is_tlab)) { result = gen0->par_allocate(size, is_tlab); if (result != NULL) { assert(gch->is_in_reserved(result), "result not in heap"); @@ -649,7 +649,7 @@ HeapWord* result = NULL; for (int i = number_of_generations() - 1; i >= 0 && result == NULL; i--) { Generation *gen = gch->get_gen(i); - if (gen->should_allocate(size, is_tlab)) { + if (gen != NULL && gen->should_allocate(size, is_tlab)) { result = gen->expand_and_allocate(size, is_tlab); } } @@ -821,7 +821,10 @@ bool GenCollectorPolicy::should_try_older_generation_allocation( size_t word_size) const { GenCollectedHeap* gch = GenCollectedHeap::heap(); - size_t gen0_capacity = gch->get_gen(0)->capacity_before_gc(); + Generation* gen = gch->get_gen(0); + guarantee(gen != NULL, "need generation"); + + size_t gen0_capacity = gen->capacity_before_gc(); return (word_size > heap_word_size(gen0_capacity)) || GC_locker::is_active_and_needs_gc() || gch->incremental_collection_failed(); --- old/src/share/vm/memory/genCollectedHeap.hpp 2013-03-19 10:34:10.000000000 -0400 +++ new/src/share/vm/memory/genCollectedHeap.hpp 2013-03-19 10:34:10.000000000 -0400 @@ -468,8 +468,9 @@ // that it would not. assert(heap()->collector_policy()->is_two_generation_policy(), "the following definition may not be suitable for an n(>2)-generation system"); - return incremental_collection_failed() || - (consult_young && !get_gen(0)->collection_attempt_is_safe()); + Generation *gen = get_gen(0); + return gen == NULL || incremental_collection_failed() || + (consult_young && !gen->collection_attempt_is_safe()); } // If a generation bails out of an incremental collection,