Up Top

Memory allocation (& GC 処理) : メモリの確保処理 (GC 処理) : slow-path の処理 (4) GC 処理


概要(Summary)

GC 処理は CollectedHeap::mem_allocate() メソッドで行われる (See: here for details).

    ((cite: hotspot/src/share/vm/gc_interface/collectedHeap.hpp))
      // Raw memory allocation facilities
      // The obj and array allocate methods are covers for these methods.
      // The permanent allocation method should default to mem_allocate if
      // permanent memory isn't supported.
      virtual HeapWord* mem_allocate(size_t size,
                                     bool is_noref,
                                     bool is_tlab,
                                     bool* gc_overhead_limit_was_exceeded) = 0;

ただし, 実際にはこのメソッドは各サブクラスでオーバーライドされているため, それぞれのサブクラス毎 (= GC アルゴリズム毎) の処理が呼び出される.

(See: here for details)

(See: here for details)

(See: here for details)

備考(Notes)

なお, CollectedHeap::mem_allocate() の引数の意味は以下の通り.

    ((cite: hotspot/src/share/vm/memory/collectorPolicy.hpp))
      // This method controls how a collector satisfies a request
      // for a block of memory.  "gc_time_limit_was_exceeded" will
      // be set to true if the adaptive size policy determine that
      // an excessive amount of time is being spent doing collections
      // and caused a NULL to be returned.  If a NULL is not returned,
      // "gc_time_limit_was_exceeded" has an undefined meaning.

Subcategories


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