Top


定義場所(file name)

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

説明(description)

// The oop passed in is the SoftReference object, and not
// the object the SoftReference points to.

名前(function name)

bool LRUCurrentHeapPolicy::should_clear_reference(oop p) {

本体部(body)

  {- -------------------------------------------
  (1) もし, 「処理対象の soft reference が最後にアクセスされた時間 - 最後に GC が行われた時間」が
      setup() 時に求めた「アクセス頻度の基準時間」よりも長ければ true を返す 
      (= アクセス頻度が少ないため, その soft reference は削除する).
      逆に短ければ false を返す (= その soft reference は消さない).
      ---------------------------------------- -}

      jlong interval = java_lang_ref_SoftReference::clock() - java_lang_ref_SoftReference::timestamp(p);
      assert(interval >= 0, "Sanity check");

      // The interval will be zero if the ref was accessed since the last scavenge/gc.
      if(interval <= _max_interval) {
        return false;
      }

      return true;
    }

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