Top


定義場所(file name)

hotspot/src/share/vm/memory/genCollectedHeap.cpp

名前(function name)

void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs,
                                          int max_level) {

本体部(body)

  {- -------------------------------------------
  (1) (変数宣言など)
      ---------------------------------------- -}

      int local_max_level;
      if (!incremental_collection_will_fail(false /* don't consult_young */) &&
          gc_cause() == GCCause::_gc_locker) {
        local_max_level = 0;
      } else {
        local_max_level = max_level;
      }

  {- -------------------------------------------
  (1) GenCollectedHeap::do_collection() を呼んで, GC を実行する.
      ---------------------------------------- -}

      do_collection(true                 /* full */,
                    clear_all_soft_refs  /* clear_all_soft_refs */,
                    0                    /* size */,
                    false                /* is_tlab */,
                    local_max_level      /* max_level */);

  {- -------------------------------------------
  (1) 実行したのが Minor GC であり, かつそれが失敗した場合は, 
      再度 GenCollectedHeap::do_collection() を呼んで Major GC を実行しておく.

      (ついでに(トレース出力)も出している)
      ---------------------------------------- -}

      // Hack XXX FIX ME !!!
      // A scavenge may not have been attempted, or may have
      // been attempted and failed, because the old gen was too full
      if (local_max_level == 0 && gc_cause() == GCCause::_gc_locker &&
          incremental_collection_will_fail(false /* don't consult_young */)) {
        if (PrintGCDetails) {
          gclog_or_tty->print_cr("GC locker: Trying a full collection "
                                 "because scavenge failed");
        }
        // This time allow the old gen to be collected as well
        do_collection(true                 /* full */,
                      clear_all_soft_refs  /* clear_all_soft_refs */,
                      0                    /* size */,
                      false                /* is_tlab */,
                      n_gens() - 1         /* max_level */);
      }
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.