src/share/vm/memory/genCollectedHeap.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-gccause-full-gc Sdiff src/share/vm/memory

src/share/vm/memory/genCollectedHeap.cpp

Print this page




 463   assert(my_thread->is_VM_thread() ||
 464          my_thread->is_ConcurrentGC_thread(),
 465          "incorrect thread type capability");
 466   assert(Heap_lock->is_locked(),
 467          "the requesting thread should have the Heap_lock");
 468   guarantee(!is_gc_active(), "collection is not reentrant");
 469   assert(max_level < n_gens(), "sanity check");
 470 
 471   if (GC_locker::check_active_before_gc()) {
 472     return; // GC is disabled (e.g. JNI GetXXXCritical operation)
 473   }
 474 
 475   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
 476                           collector_policy()->should_clear_all_soft_refs();
 477 
 478   ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
 479 
 480   const size_t perm_prev_used = perm_gen()->used();
 481 
 482   print_heap_before_gc();
 483   if (Verbose) {
 484     gclog_or_tty->print_cr("GC Cause: %s", GCCause::to_string(gc_cause()));
 485   }
 486 
 487   {
 488     FlagSetting fl(_is_gc_active, true);
 489 
 490     bool complete = full && (max_level == (n_gens()-1));
 491     const char* gc_cause_str = "GC ";
 492     if (complete) {
 493       GCCause::Cause cause = gc_cause();
 494       if (cause == GCCause::_java_lang_system_gc) {
 495         gc_cause_str = "Full GC (System) ";
 496       } else {
 497         gc_cause_str = "Full GC ";
 498       }
 499     }
 500     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
 501     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
 502     TraceTime t(gc_cause_str, PrintGCDetails, false, gclog_or_tty);
 503 
 504     gc_prologue(complete);
 505     increment_total_collections(complete);
 506 
 507     size_t gch_prev_used = used();
 508 
 509     int starting_level = 0;
 510     if (full) {
 511       // Search for the oldest generation which will collect all younger
 512       // generations, and start collection loop there.
 513       for (int i = max_level; i >= 0; i--) {
 514         if (_gens[i]->full_collects_younger_generations()) {
 515           starting_level = i;
 516           break;
 517         }
 518       }
 519     }
 520 
 521     bool must_restore_marks_for_biased_locking = false;
 522 




 463   assert(my_thread->is_VM_thread() ||
 464          my_thread->is_ConcurrentGC_thread(),
 465          "incorrect thread type capability");
 466   assert(Heap_lock->is_locked(),
 467          "the requesting thread should have the Heap_lock");
 468   guarantee(!is_gc_active(), "collection is not reentrant");
 469   assert(max_level < n_gens(), "sanity check");
 470 
 471   if (GC_locker::check_active_before_gc()) {
 472     return; // GC is disabled (e.g. JNI GetXXXCritical operation)
 473   }
 474 
 475   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
 476                           collector_policy()->should_clear_all_soft_refs();
 477 
 478   ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
 479 
 480   const size_t perm_prev_used = perm_gen()->used();
 481 
 482   print_heap_before_gc();



 483 
 484   {
 485     FlagSetting fl(_is_gc_active, true);
 486 
 487     bool complete = full && (max_level == (n_gens()-1));
 488     char* gc_cause_prefix = complete ? "Full GC" : "GC";








 489     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
 490     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
 491     TraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, gclog_or_tty);
 492 
 493     gc_prologue(complete);
 494     increment_total_collections(complete);
 495 
 496     size_t gch_prev_used = used();
 497 
 498     int starting_level = 0;
 499     if (full) {
 500       // Search for the oldest generation which will collect all younger
 501       // generations, and start collection loop there.
 502       for (int i = max_level; i >= 0; i--) {
 503         if (_gens[i]->full_collects_younger_generations()) {
 504           starting_level = i;
 505           break;
 506         }
 507       }
 508     }
 509 
 510     bool must_restore_marks_for_biased_locking = false;
 511 


src/share/vm/memory/genCollectedHeap.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File