Top


定義場所(file name)

hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

説明(description)

// Attempting to expand the heap sufficiently
// to support an allocation of the given "word_size".  If
// successful, perform the allocation and return the address of the
// allocated block, or else "NULL".

名前(function name)

HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {

本体部(body)

  {- -------------------------------------------
  (1) (assert)
      ---------------------------------------- -}

      assert_at_safepoint(true /* should_be_vm_thread */);

  {- -------------------------------------------
  (1) (verify)
      ---------------------------------------- -}

      verify_region_sets_optional();

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

      size_t expand_bytes = MAX2(word_size * HeapWordSize, MinHeapDeltaBytes);

  {- -------------------------------------------
  (1) G1CollectedHeap::expand() でヒープの拡張を試みる.
      成功すれば, G1CollectedHeap::attempt_allocation_at_safepoint() でメモリ確保を行い, 結果をリターン.
      失敗した場合は, NULL をリターン.
      ---------------------------------------- -}

      if (expand(expand_bytes)) {
        verify_region_sets_optional();
        return attempt_allocation_at_safepoint(word_size,
                                     false /* expect_null_mutator_alloc_region */);
      }
      return NULL;
    }

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