hotspot/src/share/vm/gc/shared/collectorPolicy.cpp
changeset 31358 693058672cc6
parent 31236 d4d3011aa98e
child 32362 a487889ff52d
equal deleted inserted replaced
31357:0cef600ba9b7 31358:693058672cc6
   744       result = expand_heap_and_allocate(size, is_tlab);
   744       result = expand_heap_and_allocate(size, is_tlab);
   745     }
   745     }
   746     return result;   // Could be null if we are out of space.
   746     return result;   // Could be null if we are out of space.
   747   } else if (!gch->incremental_collection_will_fail(false /* don't consult_young */)) {
   747   } else if (!gch->incremental_collection_will_fail(false /* don't consult_young */)) {
   748     // Do an incremental collection.
   748     // Do an incremental collection.
   749     gch->do_collection(false            /* full */,
   749     gch->do_collection(false,                     // full
   750                        false            /* clear_all_soft_refs */,
   750                        false,                     // clear_all_soft_refs
   751                        size             /* size */,
   751                        size,                      // size
   752                        is_tlab          /* is_tlab */,
   752                        is_tlab,                   // is_tlab
   753                        number_of_generations() - 1 /* max_level */);
   753                        GenCollectedHeap::OldGen); // max_generation
   754   } else {
   754   } else {
   755     if (Verbose && PrintGCDetails) {
   755     if (Verbose && PrintGCDetails) {
   756       gclog_or_tty->print(" :: Trying full because partial may fail :: ");
   756       gclog_or_tty->print(" :: Trying full because partial may fail :: ");
   757     }
   757     }
   758     // Try a full collection; see delta for bug id 6266275
   758     // Try a full collection; see delta for bug id 6266275
   759     // for the original code and why this has been simplified
   759     // for the original code and why this has been simplified
   760     // with from-space allocation criteria modified and
   760     // with from-space allocation criteria modified and
   761     // such allocation moved out of the safepoint path.
   761     // such allocation moved out of the safepoint path.
   762     gch->do_collection(true             /* full */,
   762     gch->do_collection(true,                      // full
   763                        false            /* clear_all_soft_refs */,
   763                        false,                     // clear_all_soft_refs
   764                        size             /* size */,
   764                        size,                      // size
   765                        is_tlab          /* is_tlab */,
   765                        is_tlab,                   // is_tlab
   766                        number_of_generations() - 1 /* max_level */);
   766                        GenCollectedHeap::OldGen); // max_generation
   767   }
   767   }
   768 
   768 
   769   result = gch->attempt_allocation(size, is_tlab, false /*first_only*/);
   769   result = gch->attempt_allocation(size, is_tlab, false /*first_only*/);
   770 
   770 
   771   if (result != NULL) {
   771   if (result != NULL) {
   785   // free memory should be here, especially if they are expensive. If this
   785   // free memory should be here, especially if they are expensive. If this
   786   // attempt fails, an OOM exception will be thrown.
   786   // attempt fails, an OOM exception will be thrown.
   787   {
   787   {
   788     UIntXFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
   788     UIntXFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
   789 
   789 
   790     gch->do_collection(true             /* full */,
   790     gch->do_collection(true,                      // full
   791                        true             /* clear_all_soft_refs */,
   791                        true,                      // clear_all_soft_refs
   792                        size             /* size */,
   792                        size,                      // size
   793                        is_tlab          /* is_tlab */,
   793                        is_tlab,                   // is_tlab
   794                        number_of_generations() - 1 /* max_level */);
   794                        GenCollectedHeap::OldGen); // max_generation
   795   }
   795   }
   796 
   796 
   797   result = gch->attempt_allocation(size, is_tlab, false /* first_only */);
   797   result = gch->attempt_allocation(size, is_tlab, false /* first_only */);
   798   if (result != NULL) {
   798   if (result != NULL) {
   799     assert(gch->is_in_reserved(result), "result not in heap");
   799     assert(gch->is_in_reserved(result), "result not in heap");