概要


マイナーGCを行う。

引数


なし。

戻り値


なし。

宣言


/* Flip the two survivor spaces.  Starting from the root set, move eden
   objects to survivor space, tenuring objects when the top of the space
   is hit.  Then tell the incremental sweeper not to sweep old objects.  */

二つのsurvivor spaceを入れ替える。ルートから始めて、edenのオブジェクトをsurvivor spaceに移動し、スペースのトップがヒットしたらオブジェクトを殿堂入りする。インクリメンタルスイーパに、旧世代のオブジェクトを廃棄しないように伝える。

extern void _gst_scavenge (void)
  ATTRIBUTE_HIDDEN;

実装



void
_gst_scavenge (void)
{
  int oldBytes, reclaimedBytes, tenuredBytes, reclaimedPercent;

  /* Force a GC as soon as possible if we're low on OOPs or memory.  */

OOPかメモリがなくなったら、できる限り早くGCを行う。

  if UNCOMMON (_gst_mem.num_free_oops < LOW_WATER_OOP_THRESHOLD
     || _gst_mem.old->heap_total * 100.0 / _gst_mem.old->heap_limit >
        _gst_mem.grow_threshold_percent
     || _gst_mem.fixed->heap_total * 100.0 / _gst_mem.fixed->heap_limit >
        _gst_mem.grow_threshold_percent)

    { 
      _gst_global_gc (0);

      _gst_incremental_gc_step ();

      return;
    }

  if (!_gst_gc_running++
      && _gst_gc_message
      && _gst_verbosity > 2
      && !_gst_regression_testing)

    {
      /* print the first part of this message before we finish
         scanning oop table for live ones, so that the delay caused by
         this scanning is apparent.  Note the use of stderr for the
         printed message.  The idea here was that generated output
         could be treated as Smalltalk code, HTML or whatever else you
         want without harm.  */

生きているオブジェクトを探すために間接ポインタテーブルをスキャンし終わる前に、このメッセージの最初の部分を表示する。そのため、このスキャンで発生した遅延を明らかにできる。メッセージを表示するのに標準エラー出力を使用する。ここでのアイデアは、生成された出力をSmalltalkのコードや、HTML, あるいは欠落することなしに欲しいと思うものとして扱えるようにするということである。

      fflush (stdout);
      fprintf (stderr, "\"Scavenging... ");
      fflush (stderr);
    }

  oldBytes = (char *) _gst_mem.eden.allocPtr - (char *) _gst_mem.eden.minPtr +
    _gst_mem.active_half->filled;

  _gst_mem.numScavenges++;
  update_stats (&stats.timeOfLastScavenge,
                &_gst_mem.timeBetweenScavenges, NULL);


  _gst_finish_incremental_gc ();

  _gst_fixup_object_pointers ();

  copy_oops ();

scan_grey_pagesなどは、この中から呼び出される。

  check_weak_refs ();

  _gst_restore_object_pointers ();

  reset_incremental_gc (_gst_mem.ot);


  update_stats (&stats.timeOfLastScavenge,
                NULL, &_gst_mem.timeToScavenge);

  reclaimedBytes = oldBytes - _gst_mem.active_half->allocated;
  if (reclaimedBytes < 0)
    reclaimedBytes = 0;

  tenuredBytes = _gst_mem.active_half->allocated - _gst_mem.active_half->filled;
  reclaimedPercent = 100.0 * reclaimedBytes / oldBytes;

  if (!--_gst_gc_running
      && _gst_gc_message
      && _gst_verbosity > 2
      && !_gst_regression_testing)
    {
      fprintf (stderr, "%d%% reclaimed, done\"\n", reclaimedPercent);
      fflush (stderr);
    }

  _gst_mem.reclaimedBytesPerScavenge =
    _gst_mem.factor * reclaimedBytes +
    (1 - _gst_mem.factor) * _gst_mem.reclaimedBytesPerScavenge;

  _gst_mem.reclaimedPercentPerScavenge =
    _gst_mem.factor * reclaimedPercent +
    (1 - _gst_mem.factor) * _gst_mem.reclaimedPercentPerScavenge;

  _gst_mem.tenuredBytesPerScavenge =
    _gst_mem.factor * tenuredBytes +
    (1 - _gst_mem.factor) * _gst_mem.tenuredBytesPerScavenge;

  _gst_invalidate_croutine_cache ();

  mourn_objects ();

}
タグ

このページへのコメント

aiwy4A Thank you for your article.Thanks Again. Want more.

0
Posted by check it out 2014年01月23日(木) 16:27:09 返信

B4QP5k Enjoyed every bit of your blog.Really thank you! Will read on...

0
Posted by seo thing 2013年12月21日(土) 06:23:41 返信

fzvCDy <a href="http://zrlwhmhpwgzf.com/">zrlwhmhpwgzf</a>, [url=http://tnykbwrxnjww.com/]tnykbwrxnjww[/url], [link=http://rkllrfavmwzj.com/]rkllrfavmwzj[/link], http://hpayqlcqcvog.com/

0
Posted by ydrqjihwefo 2013年11月15日(金) 01:38:07 返信

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

管理人/副管理人のみ編集できます